0

我正在尝试使用二进制数据构建产品推荐模型。

我的代码有一个问题,我认为这源于我传递函数时源数据的结构如何变化data.matrix=as(df,"binaryRatingMatrix")

我的代码如下:

library(recommenderlab)
library(xlsx)
#change csv to original data when problem fixed
data=read.csv("New UBCF Data V2.csv",header=TRUE,row.names=1)
#remove rows where number of purchases is <10
df=data[rowSums(data[-1])>=10,]
data.matrix=as(df,"binaryRatingMatrix")

当我打印 data.matrix 时,它指出2x2 rating matrix of class 'binaryRatingMatrix' with 3 ratings

我期待比这更多的评级,我相信这就是我在通过评估方案传递这些数据时收到错误的原因。

鉴于显示 867 个变量中str()df139 个 obs 包含零或一 (0 / 1),我期望 data.matrix 包含远远超过 3 个评级。

任何人都可以帮助解释这里发生了什么,为什么这么多评级在强制df到“binaryRatingMatrix”之间消失?

dput()以下df

structure(list(X11211 = 0L, X11258 = 0L, X11451 = 0L, X14227 = 0L, 
    X14229 = 0L, X14235 = 0L, X14251 = 0L, X14257 = 0L, X14258 = 0L, 
    X14259 = 0L, X014259B = 0L, X14260 = 0L, X14300 = 0L, X14301 = 0L, 
    X14305 = 0L, X14306 = 0L, X14307 = 0L, X14308 = 0L, X14309 = 0L, 
    X14310 = 0L, X14350 = 0L, X14501 = 0L, X14547 = 0L, X14937 = 0L, 
    X14948 = 0L, X14957 = 0L, X15236 = 0L, X15260 = 0L, X15303 = 0L, 
    X15304 = 0L, X16114 = 0L, X18119 = 0L, X18170 = 0L, X18171 = 0L, 
    X018171FF = 0L, X18173 = 0L, X18174 = 0L, X23350 = 0L, X26921 = 0L, 
    X32100 = 0L, X32103 = 0L, X32105 = 1L, X32108 = 0L, X32109 = 0L, 
    X32113 = 0L, X32114 = 0L, X32115 = 0L, X32116 = 0L, X32117 = 0L, 
    X32118 = 0L, X32121 = 0L, X32122 = 0L, X32123 = 0L, X32220 = 0L, 
    X032220UK = 0L, X32221 = 0L, X32651 = 0L, X32710 = 0L, X32720 = 0L, 
    X32822 = 0L, X32835 = 0L, X32854 = 0L, X32858 = 0L, X32859 = 0L, 
    X32860 = 0L, X32861 = 0L, X32862 = 0L, X36113 = 0L, X036113T = 0L, 
    X36114 = 0L, X36120 = 0L, X36140 = 0L, X36150 = 0L, X42111 = 0L, 
    X42115 = 0L, X42116 = 0L, X46330 = 0L, X046330A = 0L, X55103 = 0L, 
    X55107 = 0L, X55108 = 0L, X055108OC = 0L, X55109 = 0L, X55112 = 0L, 
    X55113 = 0L, X55114 = 0L, X55115 = 0L, X55116 = 0L, X55118 = 0L, 
    X55120 = 0L, X55121 = 0L, X55125 = 0L, X55203 = 1L, X55204 = 1L, 
    X55205 = 1L, X55206 = 1L, X55211 = 1L, X55212 = 1L, X55213 = 1L, 
    X55214 = 1L, X55215 = 1L, X55800 = 1L, X55801 = 1L, X55802 = 1L, 
    X55803 = 1L, X55804 = 1L, X55805 = 1L, X55806 = 1L, X55807 = 1L, 
    X55808 = 1L, X55809 = 1L, X55810 = 1L, X55811 = 1L, X055811A = 1L, 
    X55812 = 1L, X55813 = 1L, X055813A = 1L, X55814 = 1L, X55815 = 1L, 
    X55816 = 1L, X55817 = 1L, X55818 = 1L, X55819 = 1L, X55820 = 1L, 
    X55821 = 1L, X55822 = 1L, X75110 = 0L, X75111 = 0L, X75112 = 0L, 
    X75113 = 0L, X75114 = 0L, X75115 = 0L, X75116 = 0L, X75117 = 0L, 
    X75118 = 0L, X75119 = 0L, X75120 = 0L, X75121 = 0L, X75122 = 0L, 
    X75123 = 0L, X75124 = 0L, X75125 = 0L, X75126 = 0L, X75127 = 0L, 
    X75128 = 0L, X75129 = 0L, X0BG66EF = 0L, X0BLR622 = 0L, X0BLR6EF = 0L, 
    X0PMB610 = 0L, X0PMR610 = 0L, X0RT5050 = 0L, X0RT5220 = 0L, 
    X0RT5221 = 0L, X0RT5225 = 0L, X0RT5710 = 0L, X0RT5712 = 0L, 
    X0RT5713 = 0L, X0XAL422 = 0L, X0XAR422 = 0L, X0XBE510 = 0L, 
    X0XBF422 = 0L, X0XBO422 = 0L, X0XBR422 = 0L, X0XSF022 = 0L, 
    X0XSU422 = 0L, X0XZB422 = 0L, X301555 = 0L, X30400021 = 0L, 
    X30400022 = 0L, X30400023 = 0L, X3053015 = 0L, X3053031 = 0L, 
    X3053038 = 0L, X3053070 = 0L, X3053071 = 0L, X3080049 = 0L, 
    X3128001 = 0L, X3128003 = 0L, X3128004 = 0L, X3128005 = 0L, 
    X3128007 = 0L, X3128008 = 0L, X3128009 = 0L, X3128013 = 0L, 
    X3128014 = 0L, X3128015 = 0L, X3128016 = 0L, X314265 = 0L, 
    X314278 = 0L, X314281 = 0L, X314285 = 0L, X314295 = 0L, X316203 = 0L, 
    X316453 = 0L, X316454 = 0L, X316455 = 0L, X316456 = 0L, X316457 = 0L, 
    X316462 = 0L, X316463 = 0L, X316463DD = 0L, X316464 = 0L, 
    X316464DD = 0L, X316464G = 0L, X316465 = 0L, X316465DD = 0L, 
    X316902 = 0L, X316905 = 0L, X316919 = 0L, X316919GF = 0L, 
    X316919GK = 0L, X316919WS = 0L, X3400015 = 0L, X3400024 = 0L, 
    X3401001 = 0L, X3401002 = 0L, X342800 = 0L, X3520002 = 0L, 
    X3520003 = 0L, X35860 = 0L, X36517 = 0L, X36518 = 0L, X36519 = 0L, 
    X36826 = 0L, X37536 = 0L, X37537 = 0L, X3809022 = 0L, X3828863 = 0L, 
    X3A2Z310 = 0L, X3AGR5DJ = 0L, X3AJB610 = 0L, X3AJF210 = 0L, 
    X3AJF310 = 0L, X3AJP45A = 0L, X3AJS310 = 0L, X3AJS810 = 0L, 
    X3AJS810DD = 0L, X3AJW322 = 0L, X3AJY610 = 0L, X3AKF80. = 0L, 
    X3AR1610 = 0L, X3ASZ810 = 0L, X3AT7610 = 0L, X3AUS210 = 0L, 
    X3AZ1210 = 0L, X3AZ2610 = 0L, X3B2660B = 0L, X3B46610 = 0L, 
    X3B46610B = 0L, X3BBS622 = 0L, X3BBT322 = 0L, X3BBT622 = 0L, 
    X3BBT8FFDD = 0L, X3BFL310 = 0L, X3BG2622 = 0L, X3BG2663 = 0L, 
    X3BG4322 = 0L, X3BG4400 = 0L, X3BH2310 = 0L, X3BH2363 = 0L, 
    X3BH260B = 0L, X3BH2610 = 0L, X3BH3322 = 0L, X3BH3622 = 0L, 
    X3BIL010 = 0L, X3BLG622 = 0L, X3BLR310 = 0L, X3BLR61B = 0L, 
    X3BLR622 = 0L, X3BLR663 = 0L, X3BOS310 = 0L, X3BOS810 = 0L, 
    X3BR1810 = 0L, X3BR8122UK = 0L, X3BS6322UK = 0L, X3BS6663 = 0L, 
    X3BT3810 = 0L, X3BT3810DD = 0L, X3BUS322 = 0L, X3CGR310 = 0L, 
    X3CGR45A = 0L, X3CH0610 = 0L, X3CHG310 = 0L, X3CHGOAZ = 0L, 
    X3CHH310 = 0L, X3CHT610 = 0L, X3COB810 = 0L, X3COS310 = 0L, 
    X3CPK010 = 0L, X3DIL010 = 0L, X3E12622 = 0L, X3EK4400 = 0L, 
    X3EK460B = 0L, X3GEM010 = 0L, X3GEP800 = 0L, X3GSM75B = 0L, 
    X3IME610 = 0L, X3K5G810 = 0L, X3KGI410 = 0L, X3KGI710 = 0L, 
    X3KKO010 = 0L, X3KKO810 = 0L, X3KOK810 = 0L, X3KSA222 = 0L, 
    X3KSA263 = 0L, X3LOK810 = 0L, X3LOP810 = 0L, X3MAI400 = 0L, 
    X3MAI622 = 0L, X3MAM400 = 0L, X3MAS322UK = 0L, X3MAS50NDD = 0L, 
    X3MAS610 = 0L, X3MAS810 = 0L, X3MAS810DD = 0L, X3MAS810S = 0L, 
    X3MAS810SDD = 0L, X3MAS8FFDD = 0L, X3MBR322 = 0L, X3MBR400 = 0L, 
    X3MBR610 = 0L, X3MC9310 = 0L, X3MCH310 = 0L, X3MCM322UK = 0L, 
    X3MEU310 = 0L, X3MJE310 = 0L, X3MK2310 = 0L, X3MK260B = 0L, 
    X3MKH322 = 0L, X3MKH510 = 0L, X3MKH510E = 0L, X3MKM012 = 0L, 
    X3MKM810 = 0L, X3MME310 = 0L, X3MOR363 = 0L, X3MOS012 = 0L, 
    X3MPC610 = 0L, X3MPO810 = 0L, X3MPV1FS = 0L, X3MRA310 = 0L, 
    X3MRA610 = 0L, X3MRB310 = 0L, X3MRI61. = 0L, X3MTA75A = 0L, 
    X3MTE310 = 0L, X3MV5322UK = 0L, X3MV5622 = 0L, X3MVC322 = 0L, 
    X3MWN610 = 0L, X3MWO60B = 0L, X3MZO60B = 0L, X3OCG322 = 0L, 
    X3OLZ810 = 0L, X3OZ4810 = 0L, X3P2C75U = 0L, X3PAB810 = 0L, 
    X3PAG322 = 0L, X3PAP510 = 0L, X3PAR322 = 0L, X3PB6810 = 0L, 
    X3PEN810 = 0L, X3PEP310 = 0L, X3PEP610 = 0L, X3PJR810 = 0L, 
    X3PMA210 = 0L, X3PPO810 = 0L, X3PR2G10 = 0L, X3PSS610 = 0L, 
    X3PY4810 = 0L, X3PY7310 = 0L, X3PY7363 = 0L, X3PY73EF = 0L, 
    X3PY7622 = 0L, X3PYB810 = 0L, X3PYS610 = 0L, X3QUN310 = 0L, 
    X3RGB322 = 0L, X3RGB610 = 0L, X3RIF410 = 0L, X3RIG100 = 0L, 
    X3RIJ61. = 0L, X3RIM012 = 0L, X3RIM012A = 0L, X3RIS410 = 0L, 
    X3ROA610 = 0L, X3ROA75U = 0L, X3ROA810 = 0L, X3RSM75B = 0L, 
    X3RT4018 = 0L, X3RT5720 = 0L, X3RT5730 = 0L, X3RZZ810 = 0L, 
    X3S2B310 = 0L, X3S2B400 = 0L, X3S2B45X = 0L, X3S2B60B = 0L, 
    X3S2C45X = 0L, X3S2P310 = 0L, X3S2P622 = 0L, X3S5B622 = 0L, 
    X3S6B610 = 0L, X3SB2622 = 0L, X3SB4322UK = 0L, X3SB5400 = 0L, 
    X3SB6622 = 0L, X3SB6622E = 0L, X3SGK810 = 0L, X3SJS310 = 0L, 
    X3SKG810 = 0L, X3SP3210 = 0L, X3SPB610 = 0L, X3SPB610S = 0L, 
    X3SPE45C.X. = 0L, X3SPW210 = 0L, X3TOG310 = 0L, X3UQB410 = 0L, 
    X3UQG310 = 0L, X3URA610 = 0L, X3URC310 = 0L, X3USG310 = 0L, 
    X3UWP210 = 0L, X3W6N810 = 0L, X3WBG622 = 0L, X3WG1322 = 0L, 
    X3WG1610 = 0L, X3WG1663 = 0L, X3WG16EF = 0L, X3WH3622 = 0L, 
    X3WP2310 = 0L, X3WR6610 = 0L, X3WSG322 = 0L, X3WSG622 = 0L, 
    X3WSV610 = 0L, X3XAC610 = 0L, X3XAL310 = 0L, X3XAP210 = 0L, 
    X3XAR610 = 0L, X3XAS310A = 0L, X3XAT322 = 0L, X3XAV310 = 0L, 
    X3XBO610 = 0L, X3XBR310 = 0L, X3XFB2TS = 0L, X3XFB4LE = 0L, 
    X3XFB610 = 0L, X3XFB75A = 0L, X3XFP210 = 0L, X3XFR310 = 0L, 
    X3XKA112 = 0L, X3XKA310 = 0L, X3XMA322 = 0L, X3XMP610 = 0L, 
    X3XPB210 = 0L, X3XPM210 = 0L, X3XPR610 = 0L, X3XRA310 = 0L, 
    X3XRR610 = 0L, X3XSB310 = 0L, X3XTF310 = 0L, X3XVB310 = 0L, 
    X3XVB610 = 0L, X3XZB310 = 0L, X3XZW310 = 0L, X3YSM75B = 0L, 
    X4011100 = 0L, X4021100 = 0L, X4023100 = 0L, X4028100 = 0L, 
    X4030100 = 0L, X4031100 = 0L, X4032100 = 0L, X4046100 = 0L, 
    X4047100 = 0L, X4081100 = 0L, X4127100 = 0L, X4134100 = 0L, 
    X4161100 = 0L, X4182 = 0L, X4191100 = 0L, X4192100 = 0L, 
    X4194100 = 0L, X4214100 = 0L, X4230200 = 0L, X4231100 = 0L, 
    X4241100 = 0L, X4285C = 0L, X4382100 = 0L, X4390100 = 0L, 
    X4397100 = 0L, X4401100 = 0L, X4435100DD = 0L, X4438100 = 0L, 
    X4439100 = 0L, X4440100 = 0L, X4440100DD = 0L, X4441100 = 0L, 
    X4441100DD = 0L, X4442100 = 0L, X4443100 = 0L, X4447100 = 0L, 
    X4450100 = 0L, X4457100 = 0L, X4481100 = 0L, X4485100 = 0L, 
    X4487100 = 0L, X4501100 = 0L, X4503100 = 0L, X4505100 = 0L, 
    X4508100 = 0L, X4513100 = 0L, X4518100 = 0L, X4521100 = 0L, 
    X4524100 = 0L, X4525100 = 0L, X4530100 = 0L, X4540100 = 0L, 
    X4542 = 0L, X4545100 = 0L, X4546100 = 0L, X4547100 = 0L, 
    X4556100 = 0L, X4561100 = 0L, X4566100 = 0L, X4577100 = 0L, 
    X4584 = 0L, X4588 = 0L, X4591100 = 0L, X4632100 = 0L, X4638150 = 0L, 
    X4653SP = 0L, X4655S = 0L, X4661S = 0L, X4664S = 0L, X4700100 = 0L, 
    X4702100 = 0L, X4703100 = 0L, X4704100 = 0L, X4705100 = 0L, 
    X4706110 = 0L, X4707100 = 0L, X4710000A = 0L, X4714100 = 0L, 
    X4715100 = 0L, X4721100 = 0L, X4724100 = 0L, X4732100 = 0L, 
    X4733100 = 0L, X473930P = 0L, X474230P = 0L, X474830P = 0L, 
    X4751100 = 0L, X4751250 = 0L, X4755100 = 0L, X4760181 = 0L, 
    X4770100 = 0L, X4771100 = 0L, X4772100 = 0L, X4773100 = 0L, 
    X4774150 = 0L, X4775100 = 0L, X4776100 = 0L, X4777100 = 0L, 
    X4777150 = 0L, X4778150 = 0L, X4779100 = 0L, X4779150 = 0L, 
    X4781200 = 0L, X4782120 = 0L, X4783110 = 0L, X4791100 = 0L, 
    X4791100E = 0L, X4791120 = 0L, X479130P = 0L, X4792120 = 0L, 
    X479230P = 0L, X4799100 = 0L, X4804100 = 0L, X4806110 = 0L, 
    X4807100 = 0L, X4809100 = 0L, X4810100 = 0L, X4810100E = 0L, 
    X4811100 = 0L, X4812100 = 0L, X4813100 = 0L, X4814100 = 0L, 
    X4816100 = 0L, X4817100 = 0L, X4817110E = 0L, X4818100 = 0L, 
    X4819110 = 0L, X4819110E = 0L, X4821100 = 0L, X4821100E = 0L, 
    X4822100 = 0L, X4823100 = 0L, X4829100 = 0L, X4833100 = 0L, 
    X4834100 = 0L, X4838150 = 0L, X4840100 = 0L, X4840100E = 0L, 
    X4841100 = 0L, X4841100E = 0L, X4842100 = 0L, X4842100E = 0L, 
    X4844100 = 0L, X4845100 = 0L, X4846100 = 0L, X4847100 = 0L, 
    X4852100 = 0L, X4862100 = 0L, X4865100 = 0L, X4867100 = 0L, 
    X4869100 = 0L, X4872100 = 0L, X4872220 = 0L, X4875100DD = 0L, 
    X4875250DD = 0L, X4876100 = 0L, X4877100 = 0L, X4881100 = 0L, 
    X48811RT = 0L, X48812RT = 0L, X4882100 = 0L, X4882200 = 0L, 
    X4883100 = 0L, X4884100 = 0L, X4885100 = 0L, X4885200 = 0L, 
    X4886100 = 0L, X4888100 = 0L, X4891100 = 0L, X4892100 = 0L, 
    X4902100 = 0L, X4902100RL = 0L, X5038 = 0L, X5050 = 0L, X5061 = 0L, 
    X5170 = 0L, X5220 = 0L, X5221 = 0L, X5222 = 0L, X5223 = 0L, 
    X5224 = 0L, X5225 = 0L, X5226 = 0L, X5227 = 0L, X5228 = 0L, 
    X5229 = 0L, X5230 = 0L, X5231 = 0L, X5234 = 0L, X5235 = 0L, 
    X5237 = 0L, X5239 = 0L, X5240 = 0L, X5268 = 0L, X5276 = 0L, 
    X5295 = 0L, X5306 = 0L, X5307 = 0L, X5309 = 0L, X5535 = 0L, 
    X5536 = 0L, X5539 = 0L, X5540 = 0L, X5541 = 0L, X5566 = 0L, 
    X5588 = 0L, X5589 = 0L, X5646 = 0L, X5650 = 0L, X5700 = 0L, 
    X5701 = 0L, X5703 = 0L, X5708 = 0L, X5709 = 0L, X5710 = 0L, 
    X5712 = 0L, X5713 = 0L, X5714 = 0L, X5715 = 0L, X5716 = 0L, 
    X5717 = 0L, X5718 = 0L, X5719 = 0L, X5720 = 0L, X5732 = 0L, 
    X5735 = 0L, X5739 = 0L, X5751 = 0L, X5755 = 0L, X5781 = 0L, 
    X5782 = 0L, X5790 = 0L, X5791 = 0L, X5792 = 0L, X5793 = 0L, 
    X5816 = 0L, X5817 = 0L, X5818 = 0L, X5822 = 0L, X5823 = 0L, 
    X5824 = 0L, X5825 = 0L, X5826 = 0L, X5827 = 0L, X5828 = 0L, 
    X5830 = 0L, X5831 = 0L, X5832 = 0L, X5848 = 0L, X5850 = 0L, 
    X5851 = 0L, X5852 = 0L, X5857 = 0L, X5858 = 0L, X5859 = 0L, 
    X5863 = 0L, X5864 = 0L, X5865 = 0L, X5866 = 0L, X5867 = 0L, 
    X5868 = 0L, X5874 = 0L, X5875 = 0L, X5876A = 0L, X5877 = 0L, 
    X6100 = 0L, X6101 = 0L, X915294 = 0L, X915298 = 0L, X934056 = 0L, 
    X934056TP = 0L, X934061 = 0L, X934061TP = 0L, X934066 = 0L, 
    X934074 = 0L, X934076 = 0L, X934077 = 0L, X934078 = 0L, X934079 = 0L, 
    X934080 = 0L, AFI018119 = 0L, AFI0PMB610 = 0L, AFI314265 = 0L, 
    AFI314295 = 0L, AFI3AANG10 = 0L, AFI3AGT800 = 0L, AFI3AGT811 = 0L, 
    AFI3AJ6810 = 0L, AFI3AJS810 = 0L, AFI3ATB800 = 0L, AFI3AZ2810 = 0L, 
    AFI3BA2810 = 0L, AFI3BBT622 = 0L, AFI3BBT810 = 0L, AFI3BBT8FF = 0L, 
    AFI3BG2622 = 0L, AFI3BIL810 = 0L, AFI3BKR61. = 0L, AFI3BKRH35 = 0L, 
    AFI3BKW810 = 0L, AFI3BLR61B = 0L, AFI3BLV810 = 0L, AFI3BOS810 = 0L, 
    AFI3BT3810 = 0L, AFI3CGR45A = 0L, AFI3CH1810 = 0L, AFI3CHG61B = 0L, 
    AFI3COB810 = 0L, AFI3CON810 = 0L, AFI3E128UK = 0L, AFI3E4A822 = 0L, 
    AFI3E4C822 = 0L, AFI3EK28FF = 0L, AFI3EK29FF = 0L, AFI3EK4810 = 0L, 
    AFI3EK4811 = 0L, AFI3EK4822 = 0L, AFI3EK48FF = 0L, AFI3EK8810 = 0L, 
    AFI3ERK310 = 0L, AFI3K5G610 = 0L, AFI3K5G810 = 0L, AFI3KGI410 = 0L, 
    AFI3KMU810 = 0L, AFI3KSA710 = 0L, AFI3LK3810 = 0L, AFI3LOK810 = 0L, 
    AFI3MAI622 = 0L, AFI3MAI810 = 0L, AFI3MAK610 = 0L, AFI3MAS810 = 0L, 
    AFI3MAS8FF = 0L, AFI3ME375A = 0L, AFI3MEV926 = 0L, AFI3MKM810 = 0L, 
    AFI3MRB610 = 0L, AFI3MTE310 = 0L, AFI3MWV810 = 0L, AFI3OZ4810 = 0L, 
    AFI3P41810 = 0L, AFI3P41925 = 0L, AFI3PB7810 = 0L, AFI3PB7925 = 0L, 
    AFI3PBG925 = 0L, AFI3PEG810 = 0L, AFI3PEM810 = 0L, AFI3PEN810 = 0L, 
    AFI3PMA210 = 0L, AFI3POM810 = 0L, AFI3PR2G10 = 0L, AFI3PYB810 = 0L, 
    AFI3RBK610 = 0L, AFI3RG2810 = 0L, AFI3RGB610 = 0L, AFI3RIB61. = 0L, 
    AFI3RO5610 = 0L, AFI3S1P610 = 0L, AFI3SGK810 = 0L, AFI3SGK935 = 0L, 
    AFI3SK1971 = 0L, AFI3SKG810 = 0L, AFI3SP3210 = 0L, AFI3TOB610 = 0L, 
    AFI3W2G926 = 0L, AFI3W2P920 = 0L, AFI3WB2935 = 0L, AFI3WH3622 = 0L, 
    AFI3WKL810 = 0L, AFI3XRR610 = 0L, AFI4011100 = 0L, AFI4022100 = 0L, 
    AFI4031100 = 0L, AFI4032100 = 0L, AFI4050100 = 0L, AFI4062100 = 0L, 
    AFI4081100 = 0L, AFI4134100 = 0L, AFI4156100 = 0L, AFI4161100 = 0L, 
    AFI4191100 = 0L, AFI4192100 = 0L, AFI4242100 = 0L, AFI4382100 = 0L, 
    AFI4387100 = 0L, AFI4397100 = 0L, AFI4439100 = 0L, AFI4439200 = 0L, 
    AFI4443100 = 0L, AFI4449100 = 0L, AFI4485100 = 0L, AFI4502100 = 0L, 
    AFI4509100 = 0L, AFI4510100 = 0L, AFI4521100 = 0L, AFI4530100 = 0L, 
    AFI4541100 = 0L, AFI4545100 = 0L, AFI4546100 = 0L, AFI4547100 = 0L, 
    AFI4577100 = 0L, AFI4582100 = 0L, AFI4844100 = 0L), .Names = c("X11211", 
"X11258", "X11451", "X14227", "X14229", "X14235", "X14251", "X14257", 
"X14258", "X14259", "X014259B", "X14260", "X14300", "X14301", 
"X14305", "X14306", "X14307", "X14308", "X14309", "X14310", "X14350", 
"X14501", "X14547", "X14937", "X14948", "X14957", "X15236", "X15260", 
"X15303", "X15304", "X16114", "X18119", "X18170", "X18171", "X018171FF", 
"X18173", "X18174", "X23350", "X26921", "X32100", "X32103", "X32105", 
"X32108", "X32109", "X32113", "X32114", "X32115", "X32116", "X32117", 
"X32118", "X32121", "X32122", "X32123", "X32220", "X032220UK", 
"X32221", "X32651", "X32710", "X32720", "X32822", "X32835", "X32854", 
"X32858", "X32859", "X32860", "X32861", "X32862", "X36113", "X036113T", 
"X36114", "X36120", "X36140", "X36150", "X42111", "X42115", "X42116", 
"X46330", "X046330A", "X55103", "X55107", "X55108", "X055108OC", 
"X55109", "X55112", "X55113", "X55114", "X55115", "X55116", "X55118", 
"X55120", "X55121", "X55125", "X55203", "X55204", "X55205", "X55206", 
"X55211", "X55212", "X55213", "X55214", "X55215", "X55800", "X55801", 
"X55802", "X55803", "X55804", "X55805", "X55806", "X55807", "X55808", 
"X55809", "X55810", "X55811", "X055811A", "X55812", "X55813", 
"X055813A", "X55814", "X55815", "X55816", "X55817", "X55818", 
"X55819", "X55820", "X55821", "X55822", "X75110", "X75111", "X75112", 
"X75113", "X75114", "X75115", "X75116", "X75117", "X75118", "X75119", 
"X75120", "X75121", "X75122", "X75123", "X75124", "X75125", "X75126", 
"X75127", "X75128", "X75129", "X0BG66EF", "X0BLR622", "X0BLR6EF", 
"X0PMB610", "X0PMR610", "X0RT5050", "X0RT5220", "X0RT5221", "X0RT5225", 
"X0RT5710", "X0RT5712", "X0RT5713", "X0XAL422", "X0XAR422", "X0XBE510", 
"X0XBF422", "X0XBO422", "X0XBR422", "X0XSF022", "X0XSU422", "X0XZB422", 
"X301555", "X30400021", "X30400022", "X30400023", "X3053015", 
"X3053031", "X3053038", "X3053070", "X3053071", "X3080049", "X3128001", 
"X3128003", "X3128004", "X3128005", "X3128007", "X3128008", "X3128009", 
"X3128013", "X3128014", "X3128015", "X3128016", "X314265", "X314278", 
"X314281", "X314285", "X314295", "X316203", "X316453", "X316454", 
"X316455", "X316456", "X316457", "X316462", "X316463", "X316463DD", 
"X316464", "X316464DD", "X316464G", "X316465", "X316465DD", "X316902", 
"X316905", "X316919", "X316919GF", "X316919GK", "X316919WS", 
"X3400015", "X3400024", "X3401001", "X3401002", "X342800", "X3520002", 
"X3520003", "X35860", "X36517", "X36518", "X36519", "X36826", 
"X37536", "X37537", "X3809022", "X3828863", "X3A2Z310", "X3AGR5DJ", 
"X3AJB610", "X3AJF210", "X3AJF310", "X3AJP45A", "X3AJS310", "X3AJS810", 
"X3AJS810DD", "X3AJW322", "X3AJY610", "X3AKF80.", "X3AR1610", 
"X3ASZ810", "X3AT7610", "X3AUS210", "X3AZ1210", "X3AZ2610", "X3B2660B", 
"X3B46610", "X3B46610B", "X3BBS622", "X3BBT322", "X3BBT622", 
"X3BBT8FFDD", "X3BFL310", "X3BG2622", "X3BG2663", "X3BG4322", 
"X3BG4400", "X3BH2310", "X3BH2363", "X3BH260B", "X3BH2610", "X3BH3322", 
"X3BH3622", "X3BIL010", "X3BLG622", "X3BLR310", "X3BLR61B", "X3BLR622", 
"X3BLR663", "X3BOS310", "X3BOS810", "X3BR1810", "X3BR8122UK", 
"X3BS6322UK", "X3BS6663", "X3BT3810", "X3BT3810DD", "X3BUS322", 
"X3CGR310", "X3CGR45A", "X3CH0610", "X3CHG310", "X3CHGOAZ", "X3CHH310", 
"X3CHT610", "X3COB810", "X3COS310", "X3CPK010", "X3DIL010", "X3E12622", 
"X3EK4400", "X3EK460B", "X3GEM010", "X3GEP800", "X3GSM75B", "X3IME610", 
"X3K5G810", "X3KGI410", "X3KGI710", "X3KKO010", "X3KKO810", "X3KOK810", 
"X3KSA222", "X3KSA263", "X3LOK810", "X3LOP810", "X3MAI400", "X3MAI622", 
"X3MAM400", "X3MAS322UK", "X3MAS50NDD", "X3MAS610", "X3MAS810", 
"X3MAS810DD", "X3MAS810S", "X3MAS810SDD", "X3MAS8FFDD", "X3MBR322", 
"X3MBR400", "X3MBR610", "X3MC9310", "X3MCH310", "X3MCM322UK", 
"X3MEU310", "X3MJE310", "X3MK2310", "X3MK260B", "X3MKH322", "X3MKH510", 
"X3MKH510E", "X3MKM012", "X3MKM810", "X3MME310", "X3MOR363", 
"X3MOS012", "X3MPC610", "X3MPO810", "X3MPV1FS", "X3MRA310", "X3MRA610", 
"X3MRB310", "X3MRI61.", "X3MTA75A", "X3MTE310", "X3MV5322UK", 
"X3MV5622", "X3MVC322", "X3MWN610", "X3MWO60B", "X3MZO60B", "X3OCG322", 
"X3OLZ810", "X3OZ4810", "X3P2C75U", "X3PAB810", "X3PAG322", "X3PAP510", 
"X3PAR322", "X3PB6810", "X3PEN810", "X3PEP310", "X3PEP610", "X3PJR810", 
"X3PMA210", "X3PPO810", "X3PR2G10", "X3PSS610", "X3PY4810", "X3PY7310", 
"X3PY7363", "X3PY73EF", "X3PY7622", "X3PYB810", "X3PYS610", "X3QUN310", 
"X3RGB322", "X3RGB610", "X3RIF410", "X3RIG100", "X3RIJ61.", "X3RIM012", 
"X3RIM012A", "X3RIS410", "X3ROA610", "X3ROA75U", "X3ROA810", 
"X3RSM75B", "X3RT4018", "X3RT5720", "X3RT5730", "X3RZZ810", "X3S2B310", 
"X3S2B400", "X3S2B45X", "X3S2B60B", "X3S2C45X", "X3S2P310", "X3S2P622", 
"X3S5B622", "X3S6B610", "X3SB2622", "X3SB4322UK", "X3SB5400", 
"X3SB6622", "X3SB6622E", "X3SGK810", "X3SJS310", "X3SKG810", 
"X3SP3210", "X3SPB610", "X3SPB610S", "X3SPE45C.X.", "X3SPW210", 
"X3TOG310", "X3UQB410", "X3UQG310", "X3URA610", "X3URC310", "X3USG310", 
"X3UWP210", "X3W6N810", "X3WBG622", "X3WG1322", "X3WG1610", "X3WG1663", 
"X3WG16EF", "X3WH3622", "X3WP2310", "X3WR6610", "X3WSG322", "X3WSG622", 
"X3WSV610", "X3XAC610", "X3XAL310", "X3XAP210", "X3XAR610", "X3XAS310A", 
"X3XAT322", "X3XAV310", "X3XBO610", "X3XBR310", "X3XFB2TS", "X3XFB4LE", 
"X3XFB610", "X3XFB75A", "X3XFP210", "X3XFR310", "X3XKA112", "X3XKA310", 
"X3XMA322", "X3XMP610", "X3XPB210", "X3XPM210", "X3XPR610", "X3XRA310", 
"X3XRR610", "X3XSB310", "X3XTF310", "X3XVB310", "X3XVB610", "X3XZB310", 
"X3XZW310", "X3YSM75B", "X4011100", "X4021100", "X4023100", "X4028100", 
"X4030100", "X4031100", "X4032100", "X4046100", "X4047100", "X4081100", 
"X4127100", "X4134100", "X4161100", "X4182", "X4191100", "X4192100", 
"X4194100", "X4214100", "X4230200", "X4231100", "X4241100", "X4285C", 
"X4382100", "X4390100", "X4397100", "X4401100", "X4435100DD", 
"X4438100", "X4439100", "X4440100", "X4440100DD", "X4441100", 
"X4441100DD", "X4442100", "X4443100", "X4447100", "X4450100", 
"X4457100", "X4481100", "X4485100", "X4487100", "X4501100", "X4503100", 
"X4505100", "X4508100", "X4513100", "X4518100", "X4521100", "X4524100", 
"X4525100", "X4530100", "X4540100", "X4542", "X4545100", "X4546100", 
"X4547100", "X4556100", "X4561100", "X4566100", "X4577100", "X4584", 
"X4588", "X4591100", "X4632100", "X4638150", "X4653SP", "X4655S", 
"X4661S", "X4664S", "X4700100", "X4702100", "X4703100", "X4704100", 
"X4705100", "X4706110", "X4707100", "X4710000A", "X4714100", 
"X4715100", "X4721100", "X4724100", "X4732100", "X4733100", "X473930P", 
"X474230P", "X474830P", "X4751100", "X4751250", "X4755100", "X4760181", 
"X4770100", "X4771100", "X4772100", "X4773100", "X4774150", "X4775100", 
"X4776100", "X4777100", "X4777150", "X4778150", "X4779100", "X4779150", 
"X4781200", "X4782120", "X4783110", "X4791100", "X4791100E", 
"X4791120", "X479130P", "X4792120", "X479230P", "X4799100", "X4804100", 
"X4806110", "X4807100", "X4809100", "X4810100", "X4810100E", 
"X4811100", "X4812100", "X4813100", "X4814100", "X4816100", "X4817100", 
"X4817110E", "X4818100", "X4819110", "X4819110E", "X4821100", 
"X4821100E", "X4822100", "X4823100", "X4829100", "X4833100", 
"X4834100", "X4838150", "X4840100", "X4840100E", "X4841100", 
"X4841100E", "X4842100", "X4842100E", "X4844100", "X4845100", 
"X4846100", "X4847100", "X4852100", "X4862100", "X4865100", "X4867100", 
"X4869100", "X4872100", "X4872220", "X4875100DD", "X4875250DD", 
"X4876100", "X4877100", "X4881100", "X48811RT", "X48812RT", "X4882100", 
"X4882200", "X4883100", "X4884100", "X4885100", "X4885200", "X4886100", 
"X4888100", "X4891100", "X4892100", "X4902100", "X4902100RL", 
"X5038", "X5050", "X5061", "X5170", "X5220", "X5221", "X5222", 
"X5223", "X5224", "X5225", "X5226", "X5227", "X5228", "X5229", 
"X5230", "X5231", "X5234", "X5235", "X5237", "X5239", "X5240", 
"X5268", "X5276", "X5295", "X5306", "X5307", "X5309", "X5535", 
"X5536", "X5539", "X5540", "X5541", "X5566", "X5588", "X5589", 
"X5646", "X5650", "X5700", "X5701", "X5703", "X5708", "X5709", 
"X5710", "X5712", "X5713", "X5714", "X5715", "X5716", "X5717", 
"X5718", "X5719", "X5720", "X5732", "X5735", "X5739", "X5751", 
"X5755", "X5781", "X5782", "X5790", "X5791", "X5792", "X5793", 
"X5816", "X5817", "X5818", "X5822", "X5823", "X5824", "X5825", 
"X5826", "X5827", "X5828", "X5830", "X5831", "X5832", "X5848", 
"X5850", "X5851", "X5852", "X5857", "X5858", "X5859", "X5863", 
"X5864", "X5865", "X5866", "X5867", "X5868", "X5874", "X5875", 
"X5876A", "X5877", "X6100", "X6101", "X915294", "X915298", "X934056", 
"X934056TP", "X934061", "X934061TP", "X934066", "X934074", "X934076", 
"X934077", "X934078", "X934079", "X934080", "AFI018119", "AFI0PMB610", 
"AFI314265", "AFI314295", "AFI3AANG10", "AFI3AGT800", "AFI3AGT811", 
"AFI3AJ6810", "AFI3AJS810", "AFI3ATB800", "AFI3AZ2810", "AFI3BA2810", 
"AFI3BBT622", "AFI3BBT810", "AFI3BBT8FF", "AFI3BG2622", "AFI3BIL810", 
"AFI3BKR61.", "AFI3BKRH35", "AFI3BKW810", "AFI3BLR61B", "AFI3BLV810", 
"AFI3BOS810", "AFI3BT3810", "AFI3CGR45A", "AFI3CH1810", "AFI3CHG61B", 
"AFI3COB810", "AFI3CON810", "AFI3E128UK", "AFI3E4A822", "AFI3E4C822", 
"AFI3EK28FF", "AFI3EK29FF", "AFI3EK4810", "AFI3EK4811", "AFI3EK4822", 
"AFI3EK48FF", "AFI3EK8810", "AFI3ERK310", "AFI3K5G610", "AFI3K5G810", 
"AFI3KGI410", "AFI3KMU810", "AFI3KSA710", "AFI3LK3810", "AFI3LOK810", 
"AFI3MAI622", "AFI3MAI810", "AFI3MAK610", "AFI3MAS810", "AFI3MAS8FF", 
"AFI3ME375A", "AFI3MEV926", "AFI3MKM810", "AFI3MRB610", "AFI3MTE310", 
"AFI3MWV810", "AFI3OZ4810", "AFI3P41810", "AFI3P41925", "AFI3PB7810", 
"AFI3PB7925", "AFI3PBG925", "AFI3PEG810", "AFI3PEM810", "AFI3PEN810", 
"AFI3PMA210", "AFI3POM810", "AFI3PR2G10", "AFI3PYB810", "AFI3RBK610", 
"AFI3RG2810", "AFI3RGB610", "AFI3RIB61.", "AFI3RO5610", "AFI3S1P610", 
"AFI3SGK810", "AFI3SGK935", "AFI3SK1971", "AFI3SKG810", "AFI3SP3210", 
"AFI3TOB610", "AFI3W2G926", "AFI3W2P920", "AFI3WB2935", "AFI3WH3622", 
"AFI3WKL810", "AFI3XRR610", "AFI4011100", "AFI4022100", "AFI4031100", 
"AFI4032100", "AFI4050100", "AFI4062100", "AFI4081100", "AFI4134100", 
"AFI4156100", "AFI4161100", "AFI4191100", "AFI4192100", "AFI4242100", 
"AFI4382100", "AFI4387100", "AFI4397100", "AFI4439100", "AFI4439200", 
"AFI4443100", "AFI4449100", "AFI4485100", "AFI4502100", "AFI4509100", 
"AFI4510100", "AFI4521100", "AFI4530100", "AFI4541100", "AFI4545100", 
"AFI4546100", "AFI4547100", "AFI4577100", "AFI4582100", "AFI4844100"
), row.names = 1L, class = "data.frame")
4

1 回答 1

0

好吧,我已经弄清楚了-出于某种原因,在读取我的 csv 和强制转换为“binaryRating Matrix”之间,我必须先将 df 转换为矩阵。

library(recommenderlab)
library(xlsx)
#change csv to original data when problem fixed
data<-read.csv("New UBCF Data V2.csv",header=TRUE,row.names=1)
#remove rows where number of purchases is <10
df<-data[rowSums(data[-1])>=10,]
df<-as.matrix(df)
data.matrix<-as(df,"binaryRatingMatrix")
于 2018-04-17T14:10:23.463 回答