R package recommenderlab:关联规则的getRatings

时间:2017-09-26 10:45:24

标签: r recommendation-engine

我正在测试我用R中的recommenderlab包创建的二进制推荐系统。我测试了UBCF,关联规则和流行算法。当我使用getRatings(推荐)方法进行关联规则时,我得到了一个N​​ULL结果(方法getRatings对UBCF非常有效)。

您可以在下面找到完整的代码。更一般地说,我如何才能获得关于关联规则的预测信心呢?

    library("recommenderlab")
    training_data <- read.csv("training.csv",";",header=TRUE)
    mtx <- as(training_data,"binaryRatingMatrix")
    mtx = mtx[rowCounts(mtx) > 5,]
    test_index <- evaluationScheme(mtx, method="split", train=0.9, given=1)

    # creation of recommender model based on ubcf, popular, rda
    Rec.ubcf <- Recommender(getData(test_index, "train"), "UBCF")
    Rec.popular <- Recommender(getData(test_index, "train"), "POPULAR")
    Rec.rda <- Recommender(getData(test_index, "train"), "AR", param = list(supp = 0.001, conf = 0.2, maxlen = 2))

    # making predictions on the test data set
    p.ubcf <- predict(Rec.ubcf, getData(test_index, "known"), type="topNList", n=5)
    p.popular <- predict(Rec.popular, getData(test_index, "known"), type="topNList", n=5)
    p.rda <- predict(Rec.rda, getData(test_index, "known"), type="topNList", n=5)

    as(p.rda,"list")
    getRatings(p.rda)
    > NULL

0 个答案:

没有答案