Kaggle competition: Gendered Pronoun Resolution
model1.fit(get_training_dataset() , steps_per_epoch=STEPS_PER_EPOCH, epochs=5, validation_data=get_validation_dataset() )<train_model>
data_set = pd.read_csv(".. /input/names-dataset/names_dataset.csv")
 xfeatures = data_set["name"]
cv = CountVectorizer()
X = cv.fit_transform(xfeatures)
 data_set.sex.replace({'F':0,'M':1},inplace=True)
 X = X
data_set.drop_duplicates(keep="first", inplace=True)
 y =data_set.sex
print("ty",Counter(y))
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=42)
 clf = MultinomialNB()
clf.fit(X, y)
 def Predict(data):
test_name = [data]
vector = cv.transform(test_name ).toarray()
result = clf.predict(vector)[0]
return result
history1 = model1.fit(get_training_dataset() , steps_per_epoch=STEPS_PER_EPOCH, epochs=EPOCHS, callbacks = [lr_callback], validation_data=get_validation_dataset() )<find_best_params>
train_set = pd.read_csv(".. /input/gendered-pronoun-resolution/test_stage_1.tsv", encoding="utf-8", error_bad_lines=False, delimiter='\t')
 train_set["A"] = train_set["A"].apply(Predict)
 train_set["B"] = train_set["B"].apply(Predict)
display_training_curves(history1.history['loss'], history1.history['val_loss'], 'loss', 211)
 display_training_curves(history1.history['categorical_accuracy'], history1.history['val_categorical_accuracy'], 'accuracy', 212 )<choose_model_class>
train_set = train_set[["ID", "A", 'B'] ]
with strategy.scope() :
dnet = tf.keras.applications.DenseNet201(weights='imagenet', include_top=False ,input_shape=[*IMAGE_SIZE, 3])
 dnet.trainable = False
model2 = tf.keras.Sequential([
dnet,
tf.keras.layers.GlobalAveragePooling2D() ,
tf.keras.layers.Dense(len(CLASSES), activation='softmax')
 ])
 model2.compile(
 optimizer='adam',
loss = categorical_smooth_loss,
metrics=['categorical_accuracy'] 
)
 model2.summary()<train_model>
train_set = train_set.assign(NEITHER=lambda r: 1-r.A-r.B )
model2.fit(get_training_dataset() , steps_per_epoch=STEPS_PER_EPOCH, epochs=5, validation_data=get_validation_dataset() )<train_model>
train_set["NEITHER"] = abs(train_set["NEITHER"].astype(int))
history2 = model2.fit(get_training_dataset() , steps_per_epoch=STEPS_PER_EPOCH, epochs=EPOCHS, callbacks = [lr_callback], validation_data=get_validation_dataset() )<find_best_params>
train_set.to_csv('sub.csv', index=False )