Created
April 30, 2020 08:41
-
-
Save fclesio/64eebb038b6ad2a62c0370ab08d791ff to your computer and use it in GitHub Desktop.
API logging library and load H2O.ai model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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