问题
I used H2O version 3.26.0.5 to train a GBM model in a binary problem, to predict the probability of positive class. I saved the model file as MOJO and used this file to generate predictions in new data:
## first, restart R session ##
# load the model
library(h2o)
h2o.init(nthreads = -1)
model <- h2o.import_mojo("path_to_mojo_file")
# load the new data input
input <- read_csv("path_to_new_data")
input_h2o <- as.h2o(input)
# predictions
predictions <- predict(model, input_h2o)
When I run this in my computer I get different predictions than when I use the same MOJO file to predict in a production environment.
Does this should happen with the MOJO file? I believed that once the model was saved in MOJO format, you could make predictions in any environment and get the same results. Does anyone knows why this is happening?
回答1:
When I run this in my computer I get different predictions than when I use the same MOJO file to predict in a production environment.
Is the production environment running the exact same R script?
回答2:
In the end I found out there was an error in the script for the production environment. After it was fixed, the predictions became pretty close.
来源:https://stackoverflow.com/questions/59000235/reproduce-predictions-with-mojo-file-of-a-h2o-gbm-model