Kaggle competition: Toxic Comment Classification Challenge
bb_aggregations = {'MONTHS_BALANCE': ['min', 'max', 'size']}
for col in bb_cat:
bb_aggregations[col] = ['mean']
bb_agg = bb.groupby('SK_ID_BUREAU' ).agg(bb_aggregations)
 bb_agg.columns = pd.Index([e[0] + "_" + e[1].upper() for e in bb_agg.columns.tolist() ])
 bureau = bureau.join(bb_agg, how='left', on='SK_ID_BUREAU')
 bureau.drop(columns= 'SK_ID_BUREAU', inplace= True)
 del bb, bb_agg
gc.collect()<define_variables>
f_caps_gru = '.. /input/capsule-net-with-gru/submission.csv'
f_dual_embed_pl = '.. /input/submission-dual-embed-pl/submission_dual_embed(2 ).csv'
f_dual_embed_mish = '.. /input/bi-gru-lstm-dual-embedding-with-mish/submission.csv'
f_lstm_glove_tta = '.. /input/improved-lstm-baseline-glove-dropout-trainta/submission.csv'
f_dual_embed_dehyp = '.. /input/improved-lstm-baseline-bi-lstm-dual-embed-dehyp/submission.csv'
f_lstm_fast = '.. /input/improved-lstm-baseline-fasttext-dropout/submission.csv'
f_nbsvm = '.. /input/nb-svm-strong-linear-baseline/submission.csv'
f_bi_post = '.. /input/bi-post/10fold_lstmpp_am.csv'
f_dpcnn = '.. /input/dpcnn-wordcloud/10fold_dpcnn_test.csv'
f_dmcnn = '.. /input/dmcnn-demoji/10fold_dmcnn_am.csv'
f_rcn = '.. /input/rcn-capsule/10fold_capsule_am.csv'
f_attn_300d = '.. /input/attn-300d/10fold_attn_post_am.csv'
f_slgbm = '.. /input/simple-lightgbm-classifier/submission_001.csv'
num_aggregations = {
'DAYS_CREDIT': ['min', 'max', 'mean', 'var'],
'CREDIT_DAY_OVERDUE': ['max', 'mean'],
'DAYS_CREDIT_ENDDATE': ['min', 'max', 'mean'],
'AMT_CREDIT_MAX_OVERDUE': ['mean'],
'CNT_CREDIT_PROLONG': ['sum'],
'AMT_CREDIT_SUM': ['max', 'mean', 'sum'],
'AMT_CREDIT_SUM_DEBT': ['max', 'mean', 'sum'],
'AMT_CREDIT_SUM_OVERDUE': ['mean'],
'AMT_CREDIT_SUM_LIMIT': ['mean', 'sum'],
'DAYS_CREDIT_UPDATE': ['min', 'max', 'mean'],
'AMT_ANNUITY': ['max', 'mean'],
'MONTHS_BALANCE_MIN': ['min'],
'MONTHS_BALANCE_MAX': ['max'],
'MONTHS_BALANCE_SIZE': ['mean', 'sum']
}<feature_engineering>
p_caps_gru = pd.read_csv(f_caps_gru)
 p_dual_embed_pl = pd.read_csv(f_dual_embed_pl)
 p_dual_embed_mish = pd.read_csv(f_dual_embed_mish)
 p_lstm_glove_tta = pd.read_csv(f_lstm_glove_tta)
 p_dual_embed_dehyp = pd.read_csv(f_dual_embed_dehyp)
 p_lstm_fast = pd.read_csv(f_lstm_fast)
 p_nbsvm = pd.read_csv(f_nbsvm)
 p_bi_post = pd.read_csv(f_bi_post)
 p_dpcnn = pd.read_csv(f_dpcnn)
 p_dmcnn = pd.read_csv(f_dmcnn)
 p_rcn = pd.read_csv(f_rcn)
 p_attn_300d = pd.read_csv(f_attn_300d)
 p_slgbm = pd.read_csv(f_slgbm )
cat_aggregations = {}
for cat in bureau_cat: cat_aggregations[cat] = ['mean']
for cat in bb_cat: cat_aggregations[cat + "_MEAN"] = ['mean']
bureau_agg = bureau.groupby('SK_ID_CURR' ).agg({**num_aggregations, **cat_aggregations})
 bureau_agg.columns = pd.Index(['BURO_' + e[0] + "_" + e[1].upper() for e in bureau_agg.columns.tolist() ] )<merge>
label_cols = ['toxic', 'severe_toxic', 'obscene', 'threat', 'insult', 'identity_hate']
p_res = p_caps_gru.copy()
p_res[label_cols] =(p_slgbm[label_cols] + p_caps_gru[label_cols] + p_dual_embed_pl[label_cols] + p_dual_embed_mish[label_cols] + p_lstm_glove_tta[label_cols] + p_dual_embed_dehyp[label_cols] + p_lstm_fast[label_cols] + p_nbsvm[label_cols] + p_bi_post[label_cols] * 3 + p_dpcnn[label_cols] * 3 + p_dmcnn[label_cols] * 3 + p_rcn[label_cols] * 3 + p_attn_300d[label_cols] * 3)/ 23
<train_model><EOS> 
p_res.to_csv('submission.csv', index=False )