如何将r数据帧转换为h2o对象

plr*_*plr 18 r machine-learning bigdata dataframe h2o

我是R和H2O的新手,我试图找到一种方法将r数据帧转换为h2o对象.我花了一些时间研究如何做到这一点,没有运气.其他方式是可能的,并记录如下.

prosPath = system.file("extdata", "prostate.csv", package="h2o")
prostate.hex = h2o.importFile(localH2O, path = prosPath)
prostate.data.frame <- as.data.frame(prostate.hex)
Run Code Online (Sandbox Code Playgroud)

但我想要的是完全相反的.我想将r"prostate.data.frame"数据对象转换为名为"prostate.hex"的h2o对象.提前致谢.

小智 28

根据h2o版本3.6.0.8,它不需要任何参数.例:

iris.hex <- as.h2o(iris)
Run Code Online (Sandbox Code Playgroud)


Dus*_*sic 16

请试试这个:

prostate.hex <- as.h2o(localH2O, prostate.data.frame, key="prostate.hex")
Run Code Online (Sandbox Code Playgroud)

  • 现在已经过时了(因为h2o版本3).另请参阅:[无法将数据框转换为h2o对象](http://stackoverflow.com/questions/31442820/unable-to-convert-data-frame-to-h2o-object) (2认同)

Mat*_*ury 12

已接受的答案已经过时(2016年1月22日至2016年1月),所以这是现在有效的

prostate.hex <- as.h2o(prostate.data.frame, destination_frame="prostate.hex")
Run Code Online (Sandbox Code Playgroud)