用户教程说
Navigate to Data > View All
Choose to filter by the model key
Hit Save Model
Input for path: /data/h2o-training/...
Hit Submit
问题是我没有这个菜单(H2o, 3.0.0.26, web界面)
不幸的是,我不熟悉web界面,但我可以提供一个涉及r中的H2O的解决方案。函数
h2o.saveModel(object, dir = "", name = "", filename = "", force = FALSE)
和
h2o.loadModel(path, conn = h2o.getConnection())
应该提供你所需要的。我会试着去看看H2O Flow。
我也找不到显式保存模型的可能性。你能做的就是保存"流"。因此,您可以上传/导入文件,构建模型,然后保存/加载状态:-)
在H2O Flow中查看模型时,您将看到一个'Export'按钮作为可以对模型采取的操作
从那里,您将被提示在"Export Model"对话框中指定路径。指定路径并点击"Export"按钮。这将把你的模型保存到磁盘。
我指的是H2O版本3.2.0.3
我最近在h2o的2.8.6版本中构建深度学习模型时使用的一个工作示例。将模型保存在hdfs中。对于最新版本,您可能必须删除classification=T开关,并且必须将data替换为training_frame
library(h2o)
h = h2o.init(ip="xx.xxx.xxx.xxx", port=54321, startH2O = F)
cTrain.h2o <- as.h2o(h,cTrain,key="c1")
cTest.h2o <- as.h2o(h,cTest,key="c2")
nh2oD<-h2o.deeplearning(x =c(1:12),y="tgt",data=cTrain.h2o,classification=F,activation="Tanh",
rate=0.001,rho=0.99,momentum_start=0.5,momentum_stable=0.99,input_dropout_ratio=0.2,
hidden=c(12,25,11,11),hidden_dropout_ratios=c(0.4,0.4,0.4,0.4),
epochs=150,variable_importances=T,seed=1234,reproducible = T,l1=1e-5,
key="dn")
hdfsdir<-"hdfs://xxxxxxxxxx/user/xxxxxx/xxxxx/models"
h2o.saveModel(nh2oD,hdfsdir,name="DLModel1",save_cv=T,force=T)
test=h2o.loadModel(h,path=paste0(hdfsdir,"/","DLModel1"))
这个应该是你需要的
library(h2o)
h2o.init()
path = system.file("extdata", "prostate.csv", package = "h2o")
h2o_df = h2o.importFile(path)
h2o_df$CAPSULE = as.factor(h2o_df$CAPSULE)
model = h2o.glm(y = "CAPSULE",
x = c("AGE", "RACE", "PSA", "GLEASON"),
training_frame = h2o_df,
family = "binomial")
h2o.download_pojo(model)
http://h2o-release.s3.amazonaws.com/h2o/rel-slater/5/docs-website/h2o-docs/index.html POJO % 20快速% 20开始
如何在H2O Flow中保存模型:
-
转到"List All Models"
-
在模型详细信息中,你会发现一个"Export"选项
- 输入要保存为 的模型名称
- 重新导入
如何保存h2o-py训练的模型:
# say "rf" is your H2ORandomForestEstimator object. To export it
>>> path = h2o.save_model(rf, force=True) # save_model() returns the path
>>> path
u'/home/user/rf'
#to import it back again(as a new object)
>>> rafo = h2o.load_model(path)
>>> rafo # prints model details
Model Details
=============
H2ORandomForestEstimator : Distributed Random Forest
Model Key: drf1
Model Summary:
######Prints model details...................