交替最小二乘ALS(Alternating Least Squares)演算法的原理是對疏鬆陣列進行模型分解,評估缺失項的值,從而得到基本的訓練模型。在協同過濾分類方面,ALS演算法屬於User-Item CF(Collaborative Filtering),兼顧User和Item項,也稱為混合CF。本文將介紹如何使用ALS矩陣分解的結果對User和Item進行評分。
使用限制
支援的計算引擎為MaxCompute和Flink。
可視化配置組件參數
輸入樁
輸入樁(從左至右)
資料類型
建議上遊組件
是否必選
user因子表
無
是
item因子表
無
是
待評分的輸入資料
無
是
組件參數
頁簽
參數
描述
欄位設定
user列名
輸入資料來源中,使用者ID列的名稱。該列資料必須是BIGINT類型。
item列名
輸入資料來源中,item項的列名。該列資料必須是BIGINT類型。
參數設定
預測結果列名
輸出資料表中,用來制定評分結果儲存的列名。
輸出表生命週期
輸出表生命週期。
執行調優
節點個數
取值範圍為1~9999。
單個節點的記憶體大小
取值範圍為1024 MB~64*1024 MB。
輸出樁
輸出樁(從左至右)
資料類型
下遊組件
評分結果表
無
無
使用樣本
用來評分的user因子表和item因子表:
輸出的user因子表
user_id
factors
8528750
[0.026986524,0.03350178,0.03532385,0.019542359,0.020429865,0.02046867,0.022253247,0.027391396,0.018985065,0.04889483]
282500
[0.116156064,0.07193632,0.090851225,0.017075706,0.025412979,0.047022138,0.12534861,0.05869226,0.11170533,0.1640192]
4895250
[0.038429666,0.061858658,0.04236993,0.055866677,0.031814687,0.0417443,0.012085311,0.0379342,0.10767074,0.028392972]
... ...
... ...
輸出的item因子表
item_id
factors
24601
[0.0063337763,0.026349949,0.0064828005,0.01734504,0.022049638,0.0059205987,0.008568814,0.0015981696,0.0,0.013601779]
26699
[0.0027524426,0.0043066847,0.0031336215,0.00269448,0.0022347474,0.0020477585,0.0027995422,0.0025390312,0.0033011117,0.003957773]
20751
[0.03902271,0.050952066,0.032981463,0.03862796,0.048720762,0.027976315,0.02721664,0.018149626,0.0149896275,0.026251089]
... ...
... ...
評分結果表:
user_id | item_id | pred |
19500 | 143 | 1.882628425846633E-4 |
19500 | 2610 | 1.1106864974408381E-4 |
19500 | 2655 | 8.975836536251336E-6 |
19500 | 3190 | 1.6171501181361236E-4 |
19500 | 3720 | 2.3276544959571766E-4 |
19500 | 5254 | 2.420645481606698E-4 |