【发布时间】:2017-12-04 13:19:59
【问题描述】:
首先感谢您在 h2o 中实现 XGBoost!
不幸的是,我无法从从磁盘加载的 h2o xgboost 模型进行预测(我相信您会理解这真的很令人沮丧)。
我正在使用最新的稳定版 h2o,即 3.10.5.2,并且我正在使用 R 客户端。
我在下面提供了一个示例,可以让您重现该问题,
提前致谢
### Start h2o
require(h2o)
local_h2o = h2o.init()
### Source the base data set
data(mtcars)
h2o_mtcars = as.h2o(x = mtcars,destination_frame = 'h2o_mtcars')
### Fit a model to be saved
mdl_to_save = h2o.xgboost(model_id = 'mdl_to_save',y = 1,x = 2:11,training_frame = h2o_mtcars) ##This class doesnt work
#mdl_to_save = h2o.glm(model_id = 'mdl_to_save',y = 1,x = 2:11,training_frame = h2o_mtcars) ##This class works
### Take some reference predictions
ref_preds = h2o.predict(object = mdl_to_save,newdata = h2o_mtcars)
### Save the model to disk
silent = h2o.saveModel(object = mdl_to_save,path = 'INSERT_PATH',force = TRUE)
### Delete the model to make sure there cant be any strange locking issues
h2o.rm(ids = 'mdl_to_save')
### Load it back up
loaded_mdl = h2o.loadModel(path = 'INSERT_PATH/mdl_to_save')
### Score the model
### The h2o.predict statement below is what causes the error: java.lang.NullPointerException
lod_preds = h2o.predict(object = loaded_mdl,newdata = h2o_mtcars)
all.equal(ref_preds,lod_preds)
【问题讨论】:
-
这是一个已知问题,我们在这里为它开张票:0xdata.atlassian.net/browse/PUBDEV-4585 我希望它很快得到修复。仅供参考,所有开放的 H2O-XGBoost 门票都在这里:0xdata.atlassian.net/issues/?filter=21100
-
好的,好消息,你们已经在努力了。这是一个快速修复。感谢您的更新。