Alternating Least Squares (ALS) is a matrix factorization algorithm that factorizes sparse matrices and predicts the values of missing entries to obtain a basic training model. ALS, also called a hybrid collaborative filtering algorithm, combines users and items. This topic describes how to use the results of ALS matrix factorization to rate users and items.
Limits
You can use the Als Rating component of Platform for AI (PAI) based on the computing resources of MaxCompute and Flink.
Configure the component in the PAI console
Input ports
Input port (left to right)
Data type
Recommended upstream component
Required
user Factors
N/A
Yes
item Factors
N/A
Yes
data table
N/A
Data Preprocessing
Yes
Component parameters
Tab
Parameter
Description
Fields Setting
user column name
The name of the user ID column in the input table. The data in the column must be of the BIGINT type.
item column name
The name of the item column in the input table. The data in the column must be of the BIGINT type.
Parameters Setting
Prediction result column name
The name of the column that stores rating results in the output data table.
Output table lifecycle
The lifecycle of the output table.
Tuning
Number of Workers
The number of worker nodes. Valid values: 1 to 9999.
Node Memory, MB
The memory size of each worker node. Valid values: 1024 to 65536. Unit: MB.
Output ports
Output port (left to right)
Data type
Downstream component
output data
N/A
N/A
Examples
The following section provides a sample user factor table and a sample item factor table that are used in rating:
User factor table
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 factor table
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]
... ...
... ...
Rating result table
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 |