Kaggle competition: Aerial Cactus Identification
<SOS> metric: AUC Kaggle data source: aerial-cactus-identification<define_search_model>
np.random.seed(10)
 %matplotlib inline
%reload_ext autoreload
%autoreload 2
lr = LinearRegression()
rd = Ridge()
rf = RandomForestRegressor(
 n_estimators = 12,
max_depth = 3,
n_jobs = -1)
 gb = GradientBoostingRegressor()
lasso=Lasso(alpha =0.0005, random_state=1)
<train_model>
data_folder = Path(".. /input")
 train_df = pd.read_csv(".. /input/train.csv")
 test_df = pd.read_csv(".. /input/sample_submission.csv" )
model = StackingRegressor(
 regressors=[rf, gb, rd, lasso],
meta_regressor=lr)
 model.fit(final_train, df_train.SalePrice);<predict_on_test>
learn_densnet = cnn_learner(train_img, models.densenet201, metrics=[error_rate, accuracy], model_dir="/tmp/model/" )
y_pred = model.predict(final_train)
 print(sqrt(mean_squared_error(df_train.SalePrice, y_pred)) )<predict_on_test>
learn_densnet.lr_find()
learn_densnet.recorder.plot()
y_pred = model.predict(final_test )<train_model>
lr = 1e-02
learn_densnet.fit_one_cycle(5 , slice(lr))
lasso.fit(final_train, df_train.SalePrice)
 score = cross_val_score(lasso,final_train, df_train.SalePrice, scoring= 'neg_mean_absolute_error')
 print('Mean Absolute Error %2f' %(-1 * score.mean()))<save_to_csv>
preds,_ = learn_densnet.get_preds(ds_type=DatasetType.Test )
submission = pd.DataFrame({'Id': df_test.Id, 'SalePrice': np.exp(predictions)})
 submission.to_csv('submissionGB.csv', index=False)
 submission.head()<save_to_csv>
test_df.to_csv('submission.csv', index=False )