使用H2O GBM模型的MOJO文件重现预测 [英] Reproduce predictions with MOJO file of a H2O GBM model

查看:140
本文介绍了使用H2O GBM模型的MOJO文件重现预测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用H2O版本3.26.0.5在二进制问题中训练了GBM模型,以预测肯定分类的可能性.我将模型文件另存为MOJO,并使用该文件在新数据中生成了预测:

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)

当我在计算机上运行此代码时,与在生产环境中使用相同的MOJO文件进行预测时,得到的预测是不同的.

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.

MOJO文件是否应该发生这种情况?我相信,一旦将模型保存为MOJO格式,您就可以在任何环境中进行预测并获得相同的结果.有人知道为什么会这样吗?

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?

推荐答案

最后,我发现生产环境的脚本中存在错误.修复后,预测变得非常接近.

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.

这篇关于使用H2O GBM模型的MOJO文件重现预测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆