热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

如何将稀疏矩阵变为H2O?-HowtogetsparsematricesintoH2O?

IamtryingtogetasparsematrixintoH2OandIwaswonderingwhetherthatwaspossible.Supposew

I am trying to get a sparse matrix into H2O and I was wondering whether that was possible. Suppose we have the following:

我试图将一个稀疏的矩阵变成H2O,我想知道这是否可能。假设我们有以下内容:

test <- Matrix(c(1,0,0,1,1,1,1,0,1), nrow = 3, sparse = TRUE)

and assuming my local H2O is localH2O, I can't seem to do the following:

假设我的本地H2O是localH2O,我似乎无法做到以下几点:

as.h2o(test)

It gives the error: cannot coerce class "structure("dgCMatrix", package = "Matrix")" to a data.frame. That seems to be pretty logical, however assuming that test is so big that I can't transform it into a dataframe, how am I suppose to load this into H2O? Using a sparse matrix representation it is only 500MB or so.

它给出了错误:不能将类“结构(”dgCMatrix“,package =”Matrix“)强制转换为data.frame。这看起来很合乎逻辑,但假设测试太大以至于无法将其转换为数据帧,我怎么想把它加载到H2O中呢?使用稀疏矩阵表示它只有500MB左右。

How can I load a sparse matrix into H2O?

如何将稀疏矩阵加载到H2O中?

1 个解决方案

#1


7  

It is cumbersome to transport data stored in R's memory to H2O's memory for essentially two reasons: R performs a POST of the file to stream up the data into H2O, which 1) doesn't take advantage of H2O's parallel reader, and 2) limits your data to existing in R.

将存储在R存储器中的数据传输到H2O的存储器是很麻烦的,原因主要有两个:R执行文件POST以将数据流式传输到H2O,1)不利用H2O的并行读取器,2)限制你的数据存在于R.

Instead, make use of the h2o.importFile method from R to make use of H2O's parallel reader. Your data can live anywhere: HDFS, S3, regular filesystem...

相反,使用R中的h2o.importFile方法来使用H2O的并行读取器。您的数据可以在任何地方生活:HDFS,S3,常规文件系统......

H2O sports an SVMLight reader, so it is recommended to save your sparse Matrix from R in svmlight format.

H2O运行SVMLight阅读器,因此建议以svmlight格式从R保存稀疏矩阵。

Hope this helps!

希望这可以帮助!


推荐阅读
author-avatar
濮阳土著_480
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有