Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save fclesio/bf247cc482f2781f2f73128ca07ed8da to your computer and use it in GitHub Desktop.
Get infos about the AutoML best model and then serialize the model
lb <- aml@leaderboard
for (model_auto_ml in 1:nrow(lb)){
auto_ml_model_id <-
as.list(lb$model_id)[model_auto_ml][1]
auto_ml_auc <-
as.list(lb$auc)[model_auto_ml][1]
auto_ml_logloss <-
as.list(lb$logloss)[model_auto_ml][1]
auto_ml_aucpr <-
as.list(lb$aucpr)[model_auto_ml][1]
auto_ml_mean_per_class_error <-
as.list(lb$mean_per_class_error)[model_auto_ml][1]
auto_ml_rmse <-
as.list(lb$rmse)[model_auto_ml][1]
auto_ml_mse <-
as.list(lb$mse)[model_auto_ml][1]
log_info("AutoML - model_id: {auto_ml_model_id} - auc: {auto_ml_auc} - logloss: {auto_ml_logloss} - aucpr: {auto_ml_aucpr} - mean_per_class_error: {auto_ml_mean_per_class_error} - rmse: {auto_ml_rmse} - mse: {auto_ml_mse}")
}
log_info("AutoML Winning Model - model_id: {aml@leader@model_id} - algorithm: {aml@leader@algorithm} - seed: {aml@leader@parameters$seed} - metalearner_nfolds: {aml@leader@parameters$metalearner_nfolds} - training_frame: {aml@leader@parameters$training_frame} - validation_frame: {aml@leader@parameters$validation_frame}")
model_file_path <-
get_artifact_path("", MODELS_DIR)
log_info("Model destination path: {model_file_path}")
model_path <- h2o.saveModel(object=aml@leader,
path=model_file_path,
force=TRUE)
log_info("Model artifact path: {model_path}")
end_time_pipeline <- Sys.time()
log_debug('Training pipeline end time - {end_time_pipeline}')
time_elapsed_pipeline <- end_time_pipeline - start_time_pipeline
log_debug('Training pipeline time elapsed - {time_elapsed_pipeline[1]} mins')
log_debug('Training pipeline finished')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment