Kaggle competition: 2019  ML competition with KISTI
<SOS> metric: accuracy Kaggle data source: 2019-ml-competition-with-kisti<count_missing_values>
%matplotlib inline
warnings.filterwarnings("ignore", category=DeprecationWarning)
 df_train = pd.read_csv('.. /input/train.csv')
 df_test = pd.read_csv('.. /input/test.csv')
 df = df_train.append(df_test , ignore_index = True)
 df_train.shape, df_test.shape, df_train.columns.values
print(pd.isnull(test ).sum())
<count_missing_values>
df['Pclass'].isnull().sum(axis=0 )
for data in data_cleaner:
print(data.isnull().sum())
 print('
')
<create_dataframe>
df[['Pclass', 'Survived']].groupby(['Pclass'], as_index=False ).mean()
age_ref = pd.DataFrame(data=[train.groupby('Pclass')['Age'].mean() ],columns=train['Pclass'].unique())
 age_ref 
<feature_engineering>
df['Title'] = df.Name.map(lambda x: x.split(',')[1].split('.')[0].strip())
 df['Title'].value_counts()
def fill_age(pclass,age):
if pd.isnull(age):
return float(age_ref[pclass])
 else:
return age
for data in data_cleaner:
data['Age'] = train.apply(lambda x: fill_age(x['Pclass'],x['Age']), axis=1)
<categorify>
df['Title'] = df['Title'].replace('Mlle', 'Miss')
 df['Title'] = df['Title'].replace(['Mme','Lady','Ms'], 'Mrs')
 df.Title.loc[(df.Title != 'Master')&(df.Title != 'Mr')&(df.Title != 'Miss')
 &(df.Title != 'Mrs')] = 'Others'
df[['Title', 'Survived']].groupby(['Title'], as_index=False ).mean()
def fill_fare(fare):
if pd.isnull(fare):
return train['Fare'].mean()
else:
return fare
def fill_embark(embark):
if pd.isnull(embark):
return train['Embarked'].mode().iloc[0]
else:
return embark
for data in data_cleaner:
data['Fare'] = train.apply(lambda x: fill_fare(x['Fare']), axis=1)
 data['Embarked'] = train.apply(lambda x: fill_embark(x['Embarked']), axis=1 )<drop_column>
df['Title'].value_counts()
for data in data_cleaner:
data.drop(['Cabin'],axis=1,inplace=True )<count_missing_values>
df = pd.concat([df, pd.get_dummies(df['Title'])], axis=1 ).drop(labels=['Name'], axis=1 )
for data in data_cleaner:
print(data.isnull().sum())
 print('
' )<feature_engineering>
df.Sex.isnull().sum(axis=0 )
title_list = list()
for data in data_cleaner:
for title in data['Name']:
title = title.split('.')[0].split(',')[1]
title_list.append(title)
 data['Title'] = title_list
title_list = list()<count_values>
df[['Sex', 'Survived']].groupby(['Sex'], as_index=False ).mean()
train['Title'] = train['Title'].replace([ ' Don', ' Rev', ' Dr', ' Mme',' Ms', ' Major', ' Lady', ' Sir', ' Mlle', ' Col', ' Capt',
' the Countess', ' Jonkheer'], 'Others')
 train['Title'].value_counts() 
<count_values>
df.Sex = df.Sex.map({'male':0, 'female':1} )
test['Title'] = test['Title'].replace([ ' Don', ' Rev', ' Dr', ' Mme',' Ms', ' Major', ' Lady', ' Sir', ' Mlle', ' Col', ' Capt',
' the Countess', ' Jonkheer',' Dona'], 'Others')
 test['Title'].value_counts()<feature_engineering>
df.Age.isnull().sum(axis=0 )
def get_size(df):
if df['SibSp'] + df['Parch'] + 1 == 1:
return 'Single'
if df['SibSp'] + df['Parch'] + 1 > 1:
return 'Small'
if df['SibSp'] + df['Parch'] + 1 > 4:
return 'Big'
for data in data_cleaner:
data['FamilySize'] = data.apply(get_size,axis=1)
 for data in data_cleaner:
data['IsAlone'] = 1
data['IsAlone'].loc[data['FamilySize'] != 'Single'] = 0<categorify>
df.SibSp.isnull().sum(axis=0), df.Parch.isnull().sum(axis=0 )
sex = pd.get_dummies(train['Sex'],drop_first=True)
 embark = pd.get_dummies(train['Embarked'],drop_first=True)
 title = pd.get_dummies(train['Title'],drop_first=True)
 Pclass = pd.get_dummies(train['Pclass'],drop_first=True)
 FamilySize = pd.get_dummies(train['FamilySize'],drop_first=True)
 sex2 = pd.get_dummies(test['Sex'],drop_first=True)
 embark2 = pd.get_dummies(test['Embarked'],drop_first=True)
 title2 = pd.get_dummies(test['Title'],drop_first=True)
 Pclass2 = pd.get_dummies(test['Pclass'],drop_first=True)
 FamilySize2 = pd.get_dummies(test['FamilySize'],drop_first=True)
 for data in data_cleaner:
data.drop(['Sex','Embarked','Name','Ticket','PassengerId','Title','Pclass','FamilySize'],axis=1,inplace=True)
 train = pd.concat([sex,embark,train,title,FamilySize,Pclass],axis=1)
 test = pd.concat([sex2,embark2,test,title2,FamilySize2,Pclass2],axis=1 )<prepare_x_and_y>
df['Family'] = df['SibSp'] + df['Parch'] + 1
df[['Family', 'Survived']].groupby(['Family'], as_index=False ).mean()
X = train.drop('Survived',axis=1)
 y = train['Survived']
x_test = test 
<set_options>
df['Family'].value_counts()
warnings.simplefilter("ignore" )<train_on_grid>
df.Family = df.Family.map(lambda x: 0 if x > 4 else x)
 df[['Family', 'Survived']].groupby(['Family'], as_index=False ).mean()
logreg = LogisticRegression(class_weight='balanced')
 param = {'C':[0.001,0.003,0.005,0.01,0.03,0.05,0.1,0.3,0.5,1,2,3,3,4,5,10,20]}
clf = GridSearchCV(logreg,param,scoring='roc_auc',refit=True,cv=10)
 clf.fit(X,y)
 print('Best roc_auc: {:.4}, with best C: {}'.format(clf.best_score_, clf.best_params_))<train_on_grid>
df['Family'].value_counts()
seed = 60
kf = StratifiedKFold(n_splits=5,shuffle=True,random_state=seed)
 pred_test_full =0
cv_score =[]
i=1
for train_index,test_index in kf.split(X,y):
print('{} of KFold {}'.format(i,kf.n_splits))
xtr,xvl = X.loc[train_index],X.loc[test_index]
ytr,yvl = y.loc[train_index],y.loc[test_index]
lr = LogisticRegression(C=20)
 lr.fit(xtr,ytr)
 score = roc_auc_score(yvl,lr.predict(xvl))
print('ROC AUC score:',score)
 cv_score.append(score)
 pred_test = lr.predict_proba(x_test)[:,1]
pred_test_full +=pred_test
i+=1 
<compute_test_metric>
df.Ticket.isnull().sum(axis=0 )
print('Confusion matrix
',confusion_matrix(yvl,lr.predict(xvl)))
 print('Cv',cv_score,'
Mean cv Score',np.mean(cv_score))<save_to_csv>
df.Ticket = df.Ticket.map(lambda x: x[0])
 df[['Ticket', 'Survived']].groupby(['Ticket'], as_index=False ).mean()
y_pred = pred_test_full/5
submit = pd.DataFrame({'PassengerId':sub,'Survived':y_pred})
 submit['Survived'] = submit['Survived'].apply(lambda x: 1 if x>0.5 else 0)
 submit.to_csv('lr_titanic.csv',index=False)
 submit<install_modules>
df['Ticket'].value_counts()
!pip install tensorflow_addons<set_options>
df[['Ticket', 'Fare']].groupby(['Ticket'], as_index=False ).mean()
warnings.filterwarnings("ignore")
 py.init_notebook_mode(connected=True)
<categorify>
df[['Ticket', 'Pclass']].groupby(['Ticket'], as_index=False ).mean()
def regular_encode(texts, tokenizer, maxlen=512):
enc_di = tokenizer.batch_encode_plus(
 texts,
return_attention_masks=False,
return_token_type_ids=False,
pad_to_max_length=True,
max_length=maxlen 
)
 return np.array(enc_di['input_ids'])
<choose_model_class>
df.Fare.isnull().sum(axis=0)
def build_model(transformer, max_len=220):
input_word_ids = Input(shape=(max_len,), dtype=tf.int32, name="input_word_ids")
 seq_out = transformer(input_word_ids)[0]
pool= GlobalAveragePooling1D()(seq_out)
 dense=[]
FC = Dense(32,activation='relu')
 for p in np.linspace(0.2,0.5,3):
x=Dropout(p )(pool)
 x=FC(x)
 x=Dense(1,activation='sigmoid' )(x)
 dense.append(x)
 out = Average()(dense)
 model = Model(inputs=input_word_ids, outputs=out)
 optimizer=tfa.optimizers.RectifiedAdam(learning_rate=2e-5,min_lr=1e-6,total_steps=6000)
 model.compile(optimizer, loss=focal_loss() , metrics=[tf.keras.metrics.AUC() ])
 return model 
<choose_model_class>
df.Ticket[df.Fare.isnull() ]
def build_model(transformer, max_len=220):
input_word_ids = Input(shape=(max_len,), dtype=tf.int32, name="input_word_ids")
 seq_out = transformer(input_word_ids)[0]
cls_out = seq_out[:,0,:]
out=Dense(1,activation='sigmoid' )(cls_out)
 model = Model(inputs=input_word_ids, outputs=out)
 optimizer=tfa.optimizers.RectifiedAdam(learning_rate=2e-5,min_lr=1e-6,total_steps=6000)
 model.compile(optimizer, loss=focal_loss() , metrics=[tf.keras.metrics.AUC() ])
 return model 
<set_options>
df.Pclass[df.Fare.isnull() ]
try:
tpu = tf.distribute.cluster_resolver.TPUClusterResolver()
print('Running on TPU ', tpu.master())
 except ValueError:
tpu = None
if tpu:
tf.config.experimental_connect_to_cluster(tpu)
 tf.tpu.experimental.initialize_tpu_system(tpu)
 strategy = tf.distribute.experimental.TPUStrategy(tpu)
 else:
strategy = tf.distribute.get_strategy()
print("REPLICAS: ", strategy.num_replicas_in_sync )<define_variables>
df.Cabin[df.Fare.isnull() ]
AUTO = tf.data.experimental.AUTOTUNE
GCS_DS_PATH = KaggleDatasets().get_gcs_path("jigsaw-multilingual-toxic-comment-classification")
 MY_GCS_DS_PATH = KaggleDatasets().get_gcs_path("jigsaw-train-multilingual-coments-google-api")
 EPOCHS = 3
BATCH_SIZE = 16 * strategy.num_replicas_in_sync
MAX_LEN = 192
MODEL = '.. /input/jplu-tf-xlm-roberta-large' 
<load_pretrained>
df.Embarked[df.Fare.isnull() ]
tokenizer = AutoTokenizer.from_pretrained(MODEL)
<load_from_csv>
df[['Pclass', 'Fare']].groupby(['Pclass'] ).mean()
train1 = pd.read_csv("/kaggle/input/jigsaw-multilingual-toxic-comment-classification/jigsaw-toxic-comment-train.csv")
 train2 = pd.read_csv("/kaggle/input/jigsaw-multilingual-toxic-comment-classification/jigsaw-unintended-bias-train.csv")
 train2.toxic = train2.toxic.round().astype(int)
 valid = pd.read_csv('/kaggle/input/jigsaw-multilingual-toxic-comment-classification/validation.csv')
 test = pd.read_csv('/kaggle/input/jigsaw-multilingual-toxic-comment-classification/test.csv')
 sub = pd.read_csv('/kaggle/input/jigsaw-multilingual-toxic-comment-classification/sample_submission.csv')
<concatenate>
df[['Ticket', 'Fare']].groupby(['Ticket'] ).mean()
train = pd.concat([
train1[['comment_text', 'toxic']],
train2[['comment_text', 'toxic']].query('toxic==1'),
train2[['comment_text', 'toxic']].query('toxic==0' ).sample(n=90000, random_state=0)
 ])
<load_from_csv>
df[['Embarked', 'Fare']].groupby(['Embarked'] ).mean()
cols=['comment_text','lang','toxic','id']
i=0
trans=pd.DataFrame()
path=".. /input/jigsaw-train-multilingual-coments-google-api/"
for file in os.listdir(path):
if file.endswith("cleaned.csv"):
df=pd.read_csv(path+file,usecols=['comment_text','toxic','id'])
 df['lang']=file.split("-")[-2]
trans=trans.append([df[df.id.isin(toxic[i*(len(toxic)//6):(i+1)*(len(toxic)//6)])][cols],
df[df.id.isin(non_toxic[i*len(non_toxic)//6:(i+1)*len(non_toxic)//6])][cols]])
 i+=1
valid= pd.concat([valid[['comment_text','lang','toxic']],trans])
 valid = shuffle(valid ).reset_index(drop=True)
<concatenate>
guess_Fare = df.Fare.loc[(df.Ticket == '3')&(df.Pclass == 3)&(df.Embarked == 'S')].median()
df.Fare.fillna(guess_Fare , inplace=True)
 df[['Fare', 'Survived']].groupby(['Survived'],as_index=False ).mean()
valid= pd.concat([valid[['comment_text','lang','toxic']],trans] )<set_options>
df['Fare-bin'] = pd.qcut(df.Fare,5,labels=[1,2,3,4,5] ).astype(int)
 df[['Fare-bin', 'Survived']].groupby(['Fare-bin'], as_index=False ).mean()
del trans,df,train1,train2
gc.collect()<prepare_x_and_y>
df.Cabin.isnull().sum(axis=0 )
%%time
x_valid = regular_encode(valid.comment_text.values, tokenizer, maxlen=MAX_LEN)
 x_test = regular_encode(test.content.values, tokenizer, maxlen=MAX_LEN)
 y_valid=valid.toxic.values 
<create_dataframe>
df = df.drop(labels=['Cabin'], axis=1 )
test_dataset =(
 tf.data.Dataset 
.from_tensor_slices(x_test)
.batch(BATCH_SIZE)
 )<prepare_x_and_y>
df.Embarked.isnull().sum(axis=0 )
def get_fold_data(train_ind,valid_ind):
print("Getting fold data...")
 train_x=np.vstack([x_train,x_valid[train_ind]])
 train_y=np.hstack([y_train,y_valid[train_ind]])
 valid_x= x_valid[valid_ind]
valid_y =y_valid[valid_ind]
train_data =(
 tf.data.Dataset 
.from_tensor_slices(( train_x, train_y)) 
.repeat() 
.shuffle(2048)
.batch(BATCH_SIZE)
.prefetch(AUTO))
valid_data=(
 tf.data.Dataset 
.from_tensor_slices(( valid_x, valid_y)) 
.shuffle(2048)
.batch(BATCH_SIZE)
.cache() 
.prefetch(AUTO)
)
 return train_data,valid_data<compute_train_metric>
df.Embarked.fillna('S' , inplace=True )
def focal_loss(gamma=1.5, alpha=.25):
def focal_loss_fixed(y_true, y_pred):
pt_1 = tf.where(tf.equal(y_true, 1), y_pred, tf.ones_like(y_pred))
pt_0 = tf.where(tf.equal(y_true, 0), y_pred, tf.zeros_like(y_pred))
return -K.mean(alpha * K.pow(1.- pt_1, gamma)* K.log(pt_1)) - K.mean(( 1 - alpha)* K.pow(pt_0, gamma)* K.log(1.- pt_0))
return focal_loss_fixed 
<split>
df[['Embarked', 'Survived','Pclass','Fare', 'Age', 'Sex']].groupby(['Embarked'], as_index=False ).mean()
pred_test=np.zeros(( test.shape[0],1))
skf = StratifiedKFold(n_splits=5,shuffle=True,random_state=777)
 val_score=[]
for fold,(train_ind,valid_ind)in enumerate(skf.split(x_valid,valid.lang.values)) :
if fold < 0:
print("fold",fold+1)
 K.clear_session()
tf.tpu.experimental.initialize_tpu_system(tpu)
 train_data,valid_data=get_fold_data(train_ind,valid_ind)
 Checkpoint=tf.keras.callbacks.ModelCheckpoint(f"roberta_base_{fold+1}.h5", monitor='val_loss', verbose=1, save_best_only=True,
save_weights_only=True, mode='min')
 with strategy.scope() :
transformer_layer = TFAutoModel.from_pretrained(MODEL)
 model = build_model(transformer_layer, max_len=MAX_LEN)
 n_steps=(x_train.shape[0]+len(train_ind)) //BATCH_SIZE
print(n_steps)
 print("training model {} ".format(fold+1))
train_history = model.fit(
 train_data,
steps_per_epoch=n_steps,
validation_data=valid_data,
epochs=EPOCHS,callbacks=[Checkpoint],verbose=1)
 print("Loading model...")
 model.load_weights(f"roberta_base_{fold+1}.h5")
 print("fold {} validation auc {}".format(fold+1,np.mean(train_history.history['val_auc'])))
 print("fold {} validation auc {}".format(fold+1,np.mean(train_history.history['val_loss'])))
 val_score.append(np.mean(train_history.history['val_auc']))
print('predict on test.... ')
 preds=model.predict(test_dataset,verbose=1)
 pred_test+=preds/3 
<save_to_csv>
df = df.drop(labels='Embarked', axis=1 )
sub['toxic'] = pred_test
sub.to_csv('submission.csv', index=False)
 sub.head()<install_modules>
df[['Title', 'Age']].groupby(['Title'] ).mean()
!pip install tensorflow_addons<set_options>
df[['Fare-bin', 'Age']].groupby(['Fare-bin'] ).mean()
warnings.filterwarnings("ignore")
 py.init_notebook_mode(connected=True)
<categorify>
df[['SibSp', 'Age']].groupby(['SibSp'] ).mean()
def regular_encode(texts, tokenizer, maxlen=512):
enc_di = tokenizer.batch_encode_plus(
 texts,
return_attention_masks=False,
return_token_type_ids=False,
pad_to_max_length=True,
max_length=maxlen 
)
 return np.array(enc_di['input_ids'])
<choose_model_class>
df[['Parch', 'Age']].groupby(['Parch'] ).mean()
def build_model(transformer, max_len=220):
input_word_ids = Input(shape=(max_len,), dtype=tf.int32, name="input_word_ids")
 seq_out = transformer(input_word_ids)[0]
pool= GlobalAveragePooling1D()(seq_out)
 dense=[]
FC = Dense(32,activation='relu')
 for p in np.linspace(0.2,0.5,3):
x=Dropout(p )(pool)
 x=FC(x)
 x=Dense(1,activation='sigmoid' )(x)
 dense.append(x)
 out = Average()(dense)
 model = Model(inputs=input_word_ids, outputs=out)
 optimizer=tfa.optimizers.RectifiedAdam(learning_rate=2e-5,min_lr=1e-6,total_steps=6000)
 model.compile(optimizer, loss=focal_loss() , metrics=[tf.keras.metrics.AUC() ])
 return model 
<choose_model_class>
df_sub = df[['Age','Master','Miss','Mr','Mrs','Others','Fare-bin','SibSp']]
X_train = df_sub.dropna().drop('Age', axis=1)
 y_train = df['Age'].dropna()
X_test = df_sub.loc[np.isnan(df.Age)].drop('Age', axis=1)
 pca = PCA(n_components=2)
 X_train = pca.fit_transform(X_train)
 X_test = pca.transform(X_test)
 regressor = RandomForestRegressor(n_estimators = 300)
 regressor.fit(X_train, y_train)
 y_pred = np.round(regressor.predict(X_test),1)
 df.Age.loc[df.Age.isnull() ] = y_pred
df.Age.isnull().sum(axis=0 )
def build_model(transformer, max_len=220):
input_word_ids = Input(shape=(max_len,), dtype=tf.int32, name="input_word_ids")
 seq_out = transformer(input_word_ids)[0]
cls_out = seq_out[:,0,:]
out=Dense(1,activation='sigmoid' )(cls_out)
 model = Model(inputs=input_word_ids, outputs=out)
 optimizer=tfa.optimizers.RectifiedAdam(learning_rate=2e-5,min_lr=1e-6,total_steps=6000)
 model.compile(optimizer, loss=focal_loss() , metrics=[tf.keras.metrics.AUC() ])
 return model 
<set_options>
bins = [ 0, 4, 12, 18, 30, 50, 65, 100]
age_index =(1,2,3,4,5,6,7)
 df['Age-bin'] = pd.cut(df.Age, bins, labels=age_index ).astype(int)
 df[['Age-bin', 'Survived']].groupby(['Age-bin'],as_index=False ).mean()
try:
tpu = tf.distribute.cluster_resolver.TPUClusterResolver()
print('Running on TPU ', tpu.master())
 except ValueError:
tpu = None
if tpu:
tf.config.experimental_connect_to_cluster(tpu)
 tf.tpu.experimental.initialize_tpu_system(tpu)
 strategy = tf.distribute.experimental.TPUStrategy(tpu)
 else:
strategy = tf.distribute.get_strategy()
print("REPLICAS: ", strategy.num_replicas_in_sync )<define_variables>
df[['Ticket', 'Survived']].groupby(['Ticket'], as_index=False ).mean()
AUTO = tf.data.experimental.AUTOTUNE
GCS_DS_PATH = KaggleDatasets().get_gcs_path("jigsaw-multilingual-toxic-comment-classification")
 MY_GCS_DS_PATH = KaggleDatasets().get_gcs_path("jigsaw-train-multilingual-coments-google-api")
 EPOCHS = 3
BATCH_SIZE = 16 * strategy.num_replicas_in_sync
MAX_LEN = 192
MODEL = '.. /input/jplu-tf-xlm-roberta-large' 
<load_pretrained>
df['Ticket'].value_counts()
tokenizer = AutoTokenizer.from_pretrained(MODEL)
<load_from_csv>
df['Ticket'] = df['Ticket'].replace(['A','W','F','L','5','6','7','8','9'], '4')
 df[['Ticket', 'Survived']].groupby(['Ticket'], as_index=False ).mean()
train1 = pd.read_csv("/kaggle/input/jigsaw-multilingual-toxic-comment-classification/jigsaw-toxic-comment-train.csv")
 train2 = pd.read_csv("/kaggle/input/jigsaw-multilingual-toxic-comment-classification/jigsaw-unintended-bias-train.csv")
 train2.toxic = train2.toxic.round().astype(int)
 valid = pd.read_csv('/kaggle/input/jigsaw-multilingual-toxic-comment-classification/validation.csv')
 test = pd.read_csv('/kaggle/input/jigsaw-multilingual-toxic-comment-classification/test.csv')
 sub = pd.read_csv('/kaggle/input/jigsaw-multilingual-toxic-comment-classification/sample_submission.csv')
<concatenate>
df = pd.get_dummies(df,columns=['Ticket'] )
train = pd.concat([
train1[['comment_text', 'toxic']],
train2[['comment_text', 'toxic']].query('toxic==1'),
train2[['comment_text', 'toxic']].query('toxic==0' ).sample(n=90000, random_state=0)
 ])
<load_from_csv>
df = df.drop(labels=['SibSp','Parch','Age','Fare','Title'], axis=1)
 y_train = df[0:891]['Survived'].values
X_train = df[0:891].drop(['Survived','PassengerId'], axis=1 ).values
X_test = df[891:].drop(['Survived','PassengerId'], axis=1 ).values
cols=['comment_text','lang','toxic','id']
i=0
trans=pd.DataFrame()
path=".. /input/jigsaw-train-multilingual-coments-google-api/"
for file in os.listdir(path):
if file.endswith("cleaned.csv"):
df=pd.read_csv(path+file,usecols=['comment_text','toxic','id'])
 df['lang']=file.split("-")[-2]
trans=trans.append([df[df.id.isin(toxic[i*(len(toxic)//6):(i+1)*(len(toxic)//6)])][cols],
df[df.id.isin(non_toxic[i*len(non_toxic)//6:(i+1)*len(non_toxic)//6])][cols]])
 i+=1
valid= pd.concat([valid[['comment_text','lang','toxic']],trans])
 valid = shuffle(valid ).reset_index(drop=True)
<concatenate>
model = Sequential()
model.add(Dense(units = 9, kernel_initializer = 'uniform', activation = 'relu', input_dim = 17))
model.add(Dense(units = 9, kernel_initializer = 'uniform', activation = 'relu'))
model.add(Dense(units = 5, kernel_initializer = 'uniform', activation = 'relu'))
model.add(Dense(units = 1, kernel_initializer = 'uniform', activation = 'sigmoid'))
model.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy'])
 model.fit(X_train, y_train, batch_size = 32, epochs = 200 )
<set_options><EOS> 
y_pred = model.predict(X_test)
 y_final =(y_pred > 0.5 ).astype(int ).reshape(X_test.shape[0])
 output = pd.DataFrame({'PassengerId': df_test['PassengerId'], 'Survived': y_final})
 output.to_csv('prediction-ann.csv', index=False )