Recommenderlab遇到内存问题

时间:2016-04-16 15:43:24

标签: r recommendation-engine

我试图将一些推荐算法相互比较,但遇到了一些内存问题。我使用的数据集是https://drive.google.com/open?id=0By5yrncwiz_VZUpiak5Hc2l3dkE

以下是我的代码:

library(recommenderlab)
library(Matrix)

Amazon <- read.csv(Path to Reviews.csv, header = TRUE, 
               col.names = c("ID","ProductId","UserId","HelpfulnessNumerator","HelpfulnessDenominator","Score",
                             "Time","Summary","Text"),
               colClasses = c("NULL","character","character","NULL","NULL","integer","NULL","NULL","NULL"))

Amazon <- Amazon[,c("UserId","ProductId","Score")]

Amazon <- Amazon[!duplicated(Amazon[1:2]),] ## To get unique values

scheme <- evaluationScheme(r, method = "split", train = .7,
                       k = 1, given = 1 ,goodRating = 4)

algorithms <- list(
"user-based CF" = list(name="UBCF", param=list(normalize = "Z-score",
                                             method="Cosine",
                                             nn=50, minRating=3)),
"item-based CF" = list(name="IBCF", param=list(normalize = "Z-score"
))

)

results <- evaluate(scheme, algorithms, n=c(1, 3, 5))

我收到以下错误:

UBCF run fold/sample [model time/prediction time]
 1  Timing stopped at: 1.88 0 1.87 
Error in asMethod(object) : 
Cholmod error 'problem too large' at file ../Core/cholmod_dense.c, line 105
IBCF run fold/sample [model time/prediction time]
 1  Timing stopped at: 4.93 0.02 4.95 
Error in asMethod(object) : 
Cholmod error 'problem too large' at file ../Core/cholmod_dense.c, line 105
Warning message:
In .local(x, method, ...) : 
Recommender 'user-based CF' has failed and has been removed from the results!
Recommender 'item-based CF' has failed and has been removed from the results!

我尝试使用推荐的程序包我认为可以解决这个问题,但无法安装它。 https://github.com/sanealytics/recommenderlabrats

它给了我一些错误,我不能理解:

c:/rbuildtools/3.3/gcc-4.6.3/bin /../ lib / gcc / i686-w64- mingw32 / 4.6.3 /../../../../ i686-w64 -mingw32 / bin / ld.exe:找不到-llapack  collect2:ld返回1退出状态

然后我来到这个链接来解决推荐人问题,但它对我不起作用 Error while installing package from github in R. Error in dyn.load

有关如何解决内存问题的任何帮助表示赞赏

1 个答案:

答案 0 :(得分:1)

我是推荐人的作者。现在尝试安装,应该修复。然后使用RSVD / ALS来解决。即使计算机稀疏,你的矩阵太大了。

此外,在花费在AWS内存实例上之前尝试使用较小的示例可能是个好主意。