Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
API logging library and load H2O.ai model
library('logger')
library(h2o)
library('data.table')
h2o.init()
ROOT_DIR <- getwd()
PROJECT_DIR <-
'r-api-data-hackers'
MODELS_DIR <- 'models'
API_DIR <- 'api'
LOGS_DIR <- 'logs'
model_path_object <-
file.path(ROOT_DIR,
PROJECT_DIR,
MODELS_DIR,
"StackedEnsemble_AllModels_AutoML_20200428_181354")
logging_file_path <-
file.path(ROOT_DIR,
PROJECT_DIR,
LOGS_DIR,
"api_predictions.log")
log_appender(appender_file(logging_file_path))
log_layout(layout_glue_colors)
log_threshold(DEBUG)
log_info('Load saved model')
saved_model <-
h2o.loadModel(model_path_object)
log_info('Model loaded')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.