Kaggle competition: LANL Earthquake Prediction
alphas = [0.0005, 0.001, 0.01, 0.03, 0.05, 0.1]
l1_ratios = [1.5, 1.1, 1, 0.9, 0.8, 0.7, 0.5]<compute_train_metric>
h2o.init(max_mem_size='16G' )
cv_elastic = [rmse_cv(ElasticNet(alpha = alpha, l1_ratio=l1_ratio)).mean()
for(alpha, l1_ratio)in product(alphas, l1_ratios)]<choose_model_class>
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" )
ENet = make_pipeline(RobustScaler() , ElasticNet(alpha=0.0005, l1_ratio=0.5, random_state=3))<compute_train_metric>
train['time_to_failure'] = y_train['time_to_failure']
n_folds = 5
def rmsle_cv(model):
kf = KFold(n_folds, shuffle=True, random_state=42 ).get_n_splits(train.values)
 rmse= np.sqrt(-cross_val_score(model, X_train.values, y, scoring="neg_mean_squared_error", cv = kf))
return(rmse )<compute_test_metric>
x = test.columns
y = 'time_to_failure'
score = rmsle_cv(ENet)
 print("ElasticNet score: {:.4f}({:.4f})
 ".format(score.mean() , score.std()))<compute_test_metric>
aml = H2OAutoML(max_models=50000, seed=55, max_runtime_secs=31000,nfolds=0,sort_metric="MAE",stopping_metric="MAE")
 aml.train(x=x, y=y, training_frame=train )
def rmsle(y, y_pred):
return np.sqrt(mean_squared_error(y, y_pred))<split>
aml.leader
X_train2, X_test2, y_train2, y_test2 = train_test_split(X_train, y, test_size=0.3, random_state=0)
 ENet.fit(X_train2, y_train2)
 ENet.score(X_test2,y_test2)*100<compute_test_metric>
preds = aml.predict(test )
<count_values><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_1.csv', index=False )