Kaggle competition: DonorsChoose.org Application Screening
elec = []
for i, row in heads.iterrows() :
if row['noelec'] == 1:
elec.append(0)
 elif row['coopele'] == 1:
elec.append(1)
 elif row['public'] == 1:
elec.append(2)
 elif row['planpri'] == 1:
elec.append(3)
 else:
elec.append(np.nan)
 heads['elec'] = elec
heads['elec-missing'] = heads['elec'].isnull()<drop_column>
EDA_LB_val =.73395
print("EDA_LB_val: {}".format(EDA_LB_val))
DEEP_LB_val =.79336
print("DEEP_LB_val: {}".format(DEEP_LB_val))
WORD_LB_val =.78723
print("WORD_LB_val: {}".format(WORD_LB_val))
heads = heads.drop(columns = ['noelec', 'coopele', 'public', 'planpri'] )<groupby>
almost_zero = 1e-10
almost_one = 1-almost_zero
heads=heads.drop(columns=['area2'])
 heads.groupby('area1')['Target'].value_counts(normalize=True )<feature_engineering>
EDA_input_file = ".. /input/fork-of-donorschoose-lr-model-cat-smote/LR_stack_glove100_submission.csv"
DEEP_input_file = ".. /input/fork-of-donorschoose-full-cnn-yes-smote/deep_model_fasttext300_fullSMOTE_submission.csv"
WORD_input_file = ".. /input/donorschoose-word-model/WORD_model_smote_fas_submission.csv"
EDA_df = pd.read_csv(EDA_input_file ).rename(columns={'project_is_approved': 'EDA_project_is_approved'})
 DEEP_df = pd.read_csv(DEEP_input_file ).rename(columns={'project_is_approved': 'DEEP_project_is_approved'})
 WORD_df = pd.read_csv(WORD_input_file ).rename(columns={'project_is_approved': 'WORD_project_is_approved'} )
heads['walls']=np.argmax(np.array(heads[['epared1', 'epared2', 'epared3']]),axis=1 )<drop_column>
ensemble_df = pd.merge(EDA_df, DEEP_df, on='id')
 ensemble_df = pd.merge(ensemble_df, WORD_df, on='id' )
heads = heads.drop(columns = ['epared1', 'epared2', 'epared3'] )<drop_column>
power = 68
EDA_weights = EDA_LB_val ** power
DEEP_weights = DEEP_LB_val ** power
WORD_weights = WORD_LB_val ** power
EDA_numbers = ensemble_df['EDA_project_is_approved'].clip(almost_zero,almost_one ).apply(logit)* EDA_weights
DEEP_numbers = ensemble_df['DEEP_project_is_approved'].clip(almost_zero,almost_one ).apply(logit)* DEEP_weights
WORD_numbers = ensemble_df['WORD_project_is_approved'].clip(almost_zero,almost_one ).apply(logit)* WORD_weights
totalweights = EDA_weights + DEEP_weights + WORD_weights
ensemble_df['project_is_approved'] =(EDA_numbers + DEEP_numbers + WORD_numbers)/ totalweights
ensemble_df['project_is_approved'] = ensemble_df['project_is_approved'].apply(expit )
<feature_engineering><EOS> 
ensemble_df[['id', 'project_is_approved']].to_csv("ensemble_EDA_plus_DEEPfasttext300_plus_WORDfasttext_submission.csv", index=False )