Kaggle competition: Google QUEST Q&A Labeling
<train_on_grid><EOS> 
import pandas as pd
<SOS> metric: MCSpearmanR Kaggle data source: google-quest-q&a-labeling<train_on_grid>
import pandas as pd
bnb = BernoulliNB()
parameter_grid = {'alpha': [0.0001, 1, 2, 10]
}
grid_search = GridSearchCV(bnb, param_grid=parameter_grid, cv=folds, scoring='roc_auc', n_jobs=-1)
 grid_search.fit(X_train, y_train)
 print('Best score: {}'.format(grid_search.best_score_))
print('Best parameters: {}'.format(grid_search.best_params_))
bnb = BernoulliNB(**grid_search.best_params_)
 oof_bnb, prediction_bnb, scores_bnb = train_model(X_train, X_test, y_train, params=None, model_type='sklearn', model=bnb )<choose_model_class>
sub = pd.read_csv(".. /input/google-quest-qa-subm-files/final_submission.csv")
 sample_submission = pd.read_csv(".. /input/google-quest-challenge/sample_submission.csv" )
sgd = linear_model.SGDClassifier(eta0=1, max_iter=1000, tol=0.0001)
 parameter_grid = {'loss': ['log', 'modified_huber'],
'penalty': ['l1', 'l2', 'elasticnet'],
'alpha': [0.001, 0.01],
'l1_ratio': [0, 0.15, 0.5, 1.0],
'learning_rate': ['optimal', 'invscaling', 'adaptive']
}
grid_search = GridSearchCV(sgd, param_grid=parameter_grid, cv=folds, scoring='roc_auc', n_jobs=-1)
 grid_search.fit(X_train, y_train)
 print('Best score: {}'.format(grid_search.best_score_))
print('Best parameters: {}'.format(grid_search.best_params_))
sgd = linear_model.SGDClassifier(eta0=1, tol=0.0001, **grid_search.best_params_)
 oof_sgd, prediction_sgd, scores_sgd = train_model(X_train, X_test, y_train, params=None, model_type='sklearn', model=sgd )<train_model>
id_in_sub = set(sub.qa_id)
 id_in_sample_submission = set(sample_submission.qa_id)
 diff = id_in_sample_submission - id_in_sub
sample_submission = pd.concat([
sub,
sample_submission[sample_submission.qa_id.isin(diff)]
] ).reset_index(drop=True )
<normalization><EOS> 
sample_submission.to_csv("submission.csv", index=False )