Everyone has a rating system in their mind. The rating that a user assigns to a content item, such as a movie or a song, reflects whether the user likes or dislikes the content item. If a content provider can predict the ratings to be assigned by users to content, the provider can better understand user requirements. This way, the provider can recommend content to users more precisely. This topic describes how to use Alternating Least Squares (ALS), a factorization algorithm, to predict the ratings to be assigned by users to songs.
Prerequisites
A workspace is created. For more information, see Create a workspace.
ALS
ALS is a matrix factorization algorithm that factorizes sparse matrices and predicts the values of missing entries to obtain a basic training model. ALS is also known as a hybrid collaborative filtering algorithm that combines users and items.
Matrix A = Transpose of Matrix X × Transpose of Matrix Y
The columns in Matrix X and rows in Matrix Y are known as factors in ALS. Assume that Matrix X and Matrix Y contain three factors: personality, education level, and interest. The following figure shows Matrix X that is factorized from Matrix A. Matrix X contains Vector M of each user. The following figure shows Matrix Y that is factorized from Matrix A. Matrix Y contains Vector N of each song. Based on the factorized data, ratings can be predicted. For example, to predict the rating that User 6 assigns to Red Bean, you can multiply Vector M of User 6 in Matrix X by Vector N of Red Bean in Matrix Y. Predict ratings of songs
- Go to the Machine Learning Designer page.
- Log on to the Machine Learning Platform for AI console.
- In the left-side navigation pane, click Workspaces. On the Workspace list page, click the name of the workspace that you want to manage.
- In the left-side navigation pane, choose to go to the Machine Learning Designer page.
- In the upper-right corner of the Visualized Modeling (Designer) page, click Go to Studio (Old Version).
- Create and run an experiment.
- View the results of the experiment.
- After the experiment is run, right-click ALS Training-1 on the canvas and choose . In the dialog box that appears, view the data of Matrix X.
- Right-click ALS Training-1 on the canvas and choose . In the dialog box that appears, view the data of Matrix Y.
- Predict ratings. To predict the rating that User 1 assigns to Item 978130429, multiply Vector M of User 1 in Matrix X by Vector N of Item 978130429 in Matrix Y.
# Vector M [0.5775652527809143,0.6737191677093506,0.9059759974479675,0.9866708517074585,0.15602371096611023,0.2735472023487091,0.4610620439052582,0.5312653183937073,0.3408969044685364,1.4993919134140015] # Vector N [0.2431642860174179,0.6019538044929504,0.4035401940345764,0.254305899143219,0.4056856632232666,0.46871861815452576,0.3701469600200653,0.3757922947406769,0.26486095786094666,0.37488409876823425]