提问人:mindstorm84 提问时间:7/27/2023 更新时间:7/27/2023 访问量:22
h2o H2OGenericEstimator 训练函数不起作用
h2o H2OGenericEstimator training function not working
问:
我想使用 H2O 模型启用增量训练。我使用 MOJO 格式为现有数据集/观察结果保存训练的模型。收到新的观测结果后,我想加载基于 MOJO 的模型,并根据新的观测值重新训练现有模型。但是,这是行不通的。
或者,我可以使用特定的模型类(例如,在组合数据集上的 H2OGradientBoostingEstimator)训练模型,但这需要我跟踪所有先前的观察结果并导致更高的磁盘使用率。
H2OGenericEstimator 的 H2O 文档显示了对训练函数的支持。然而,根据实验,训练函数实际上没有任何区别。
from h2o.estimators import H2OGenericEstimator, H2OXGBoostEstimator
import tempfile
airlines= h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/smalldata/testng/airlines_train.csv")
y = "IsDepDelayed"
x = ["fYear","fMonth","Origin","Dest","Distance"]
xgb = H2OXGBoostEstimator(ntrees=1, nfolds=3)
xgb.train(x=x, y=y, training_frame=airlines)
original_model_filename = tempfile.mkdtemp()
original_model_filename = xgb.download_mojo(original_model_filename)
key = h2o.lazy_import(original_model_filename)
fr = h2o.get_frame(key[0])
model = H2OGenericEstimator(model_key=fr)
model.train()
model.auc()
有没有办法训练使用 MOJO 文件加载的模型?
答:
1赞
Wendy
7/27/2023
#1
目前,从 mojo 文件加载的 h2o 通用估计器可以执行评分,但无法再次训练。
如果您对训练以前构建的模型感兴趣,请考虑使用 checkpoint。以下是有关它的文档:https://docs.h2o.ai/h2o/latest-stable/h2o-docs/data-science/algo-params/checkpoint.html#:~:text=The%20checkpoint%20option%20allows%20you,continuing%20building%20a%20previous%20model。
评论
0赞
mindstorm84
7/28/2023
检查点将解决磁盘问题。我认为唯一的问题是我需要将模型保存在服务器的内存中。如果我的服务器以某种方式出现故障,则需要重新训练完整的数据集。
评论