Reproduce predictions with MOJO file of a H2O GBM model

吃可爱长大的小学妹 提交于 2019-12-24 22:32:21

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!