Kaggle competition: LANL Earthquake Prediction
%%time
df_train_sum, df_train = fe(df_train )<compute_test_metric>
print(h2o.__version__)
 h2o.init(max_mem_size='16G' )
%%time
df_test_sum, df_test = fe(df_test )<create_dataframe>
train = h2o.import_file(".. /input/andrews-features-only/X_tr.csv")
 test = h2o.import_file(".. /input/andrews-features-only/X_test.csv")
 y_train = h2o.import_file(".. /input/andrews-features-only/y_tr.csv" )
corr_matrix = df_train.corr().abs()
sol =(corr_matrix.where(np.triu(np.ones(corr_matrix.shape), k=1 ).astype(np.bool)) 
.stack() 
.sort_values(ascending=False))
top_df = pd.DataFrame(sol ).reset_index()<rename_columns>
train['time_to_failure'] = y_train['time_to_failure']
top_df.columns = ["var1", "var2", "corr"]
top_df.head(10 )<feature_engineering>
x = test.columns
y = 'time_to_failure'
for x in range(len(top_df)) :
var1 = top_df.iloc[x]["var1"]
var2 = top_df.iloc[x]["var2"]
corr = cor[var1][var2]
top_df.at[x, "corr2"] = corr
top_df.head(20 )<groupby>
aml = H2OAutoML(max_models=1000, seed=121, max_runtime_secs=31000)
 aml.train(x=x, y=y, training_frame=train )
df_train.groupby("target" ).mean()<drop_column>
aml.leader
feature_cols = list(df_train.columns)
 feature_cols.remove('row_id')
 feature_cols.remove('series_id')
 feature_cols.remove('measurement_number')
 feature_cols.remove('target')
<save_to_csv>
preds = aml.predict(test )
<normalization><EOS> 
sample_submission = pd.read_csv('.. /input/LANL-Earthquake-Prediction/sample_submission.csv')
 sample_submission['time_to_failure'] = preds.as_data_frame().values.flatten()
sample_submission.to_csv('h2o_submission_8.csv', index=False )