经过几个小时的阅读,我发现在R中处理大(非常大的矩阵)的最好方法是使用bigalgebra
我想存储一个不适合RAM的80,000 x 80,000个0的大矩阵,然后用一个大矩阵乘法的结果替换它的单元。
我有这个错误
Error in CreateFileBackedBigMatrix(as.character(backingfile), as.character(backingpath)
Problem creating filebacked matrix.做完之后
my_matrix <- filebacked.big.matrix(ncol = ncol(Xt), nrow = nrow(X),
type = "double", backingpath = getwd(),
descriptorfile = "X.bin.desc", backingfile = "X.bin")这是我的数据的一个可重现的类似案例
X <- matrix(rexp(200, rate=.1), ncol = 11, nrow = 80000)
Xt <- t(X)所以我的全部内容是
library(bigalgebra)
X <- matrix(rexp(200, rate=.1), ncol = 11, nrow = 80000)
Xt <- t(X)
my_matrix <- filebacked.big.matrix(ncol = ncol(Xt), nrow = nrow(X),
type = "double", backingpath = getwd(),
descriptorfile = "X.bin.desc", backingfile = "X.bin")但是,如果我运行以下命令(在我的例子中没有用)
my_matrix <- filebacked.big.matrix(ncol = ncol(X), nrow = nrow(Xt),
type = "double", backingpath = getwd(),
descriptorfile = "X.bin.desc", backingfile = "X.bin")它在没有警告的情况下运行,并存储一个小的11 x 11矩阵。
我使用带有12 GB内存的操作系统El Capitan,我知道$X^t * X$需要大约47 GB内存才能进行计算,这就是为什么我使用bigalgebra将其存储在硬盘中。
发布于 2018-04-01 04:02:20
检查可用的硬盘空间,因为您发出的错误信号可能是由于硬盘空间不足,无法写入filebacked.big.matrix所需的备份文件。我也遇到过同样的错误,我通过将外部硬盘驱动器指定为"backingpath“来解决它。
https://stackoverflow.com/questions/40685470
复制相似问题