Kaggle competition: Titanic - Machine Learning from Disaster
<SOS> metric: categorizationaccuracy Kaggle data source: titanic-machine-learning-from-disaster<save_to_csv>
train, test = pd.read_csv('.. /input/train.csv'), pd.read_csv('.. /input/test.csv')
 train['Boy'], test['Boy'] = [(df.Name.str.split().str[1] == 'Master.' ).astype('int')for df in [train, test]]
train['Surname'], test['Surname'] = [df.Name.str.split(',' ).str[0] for df in [train, test]]
model = catboost.CatBoostClassifier(one_hot_max_size=4, iterations=100, random_seed=0, verbose=False)
 model.fit(train[['Sex', 'Pclass', 'Embarked', 'Boy', 'Surname']].fillna(''), train['Survived'], cat_features=[0, 2, 4])
 pred = model.predict(test[['Sex', 'Pclass', 'Embarked', 'Boy', 'Surname']].fillna('')).astype('int')
 pd.concat([test['PassengerId'], pd.DataFrame(pred, columns=['Survived'])], axis=1 ).to_csv('submission.csv', index=False )
submission_df_resnext = pd.DataFrame({"filename": test_videos, "label": predictions})
 submission_df_resnext.to_csv("submission_resnext.csv", index=False )<install_modules>
features = ['Sex', 'Pclass', 'Embarked']
X_train = train[features].fillna('')
 y_train = train['Survived']
X_test = test[features].fillna('')
 model = catboost.CatBoostClassifier(
 one_hot_max_size=4,
iterations=100,
random_seed=0,
verbose=False,
eval_metric='Accuracy' 
)
 pool = catboost.Pool(X_train, y_train, cat_features=[0, 2])
 print('To see the Catboost plots, fork this kernel and run it in the editing mode.')
 cv_scores = catboost.cv(pool, model.get_params() , fold_count=10, plot=True)
 print('CV score: {:.5f}'.format(cv_scores['test-Accuracy-mean'].values[-1]))
!pip install.. /input/deepfake-xception-trained-model/pytorchcv-0.0.55-py2.py3-none-any.whl --quiet<define_variables>
model.fit(pool)
 pred = model.predict(X_test ).astype('int')
 output = pd.concat([test['PassengerId'], pd.DataFrame(pred, columns=['Survived'])], axis=1)
 output.to_csv('submission2.csv', index=False )
test_dir = "/kaggle/input/deepfake-detection-challenge/test_videos/"
test_videos = sorted([x for x in os.listdir(test_dir)if x[-4:] == ".mp4"])
 len(test_videos )<set_options>
features = ['Sex', 'Pclass', 'Embarked', 'Boy']
X_train = train[features].fillna('')
 y_train = train['Survived']
X_test = test[features].fillna('')
 model = catboost.CatBoostClassifier(
 one_hot_max_size=4,
iterations=100,
random_seed=0,
verbose=False,
eval_metric='Accuracy' 
)
 pool = catboost.Pool(X_train, y_train, cat_features=[0, 2])
 print('To see the Catboost plots, fork this kernel and run it in the editing mode.')
 cv_scores = catboost.cv(pool, model.get_params() , fold_count=10, plot=True)
 print('CV score: {:.5f}'.format(cv_scores['test-Accuracy-mean'].values[-1]))
gpu = torch.device("cuda:0" if torch.cuda.is_available() else "cpu" )<load_pretrained>
model.fit(pool)
 pred = model.predict(X_test ).astype('int')
 output = pd.concat([test['PassengerId'], pd.DataFrame(pred, columns=['Survived'])], axis=1)
 output.to_csv('submission3.csv', index=False )
facedet = BlazeFace().to(gpu)
 facedet.load_weights("/kaggle/input/blazeface-pytorch/blazeface.pth")
 facedet.load_anchors("/kaggle/input/blazeface-pytorch/anchors.npy")
 _ = facedet.train(False )<load_pretrained>
features = ['Sex', 'Pclass', 'Embarked', 'Boy', 'Surname']
X_train = train[features].fillna('')
 y_train = train['Survived']
X_test = test[features].fillna('')
 model = catboost.CatBoostClassifier(
 one_hot_max_size=4,
iterations=100,
random_seed=0,
verbose=False,
eval_metric='Accuracy' 
)
 pool = catboost.Pool(X_train, y_train, cat_features=[0, 2, 4])
 print('To see the Catboost plots, fork this kernel and run it in the editing mode.')
 cv_scores = catboost.cv(pool, model.get_params() , fold_count=10, plot=True)
 print('CV score: {:.5f}'.format(cv_scores['test-Accuracy-mean'].values[-1]))
<define_variables><EOS> 
model.fit(pool)
 pred = model.predict(X_test ).astype('int')
 output = pd.concat([test['PassengerId'], pd.DataFrame(pred, columns=['Survived'])], axis=1)
 output.to_csv('submission4.csv', index=False )