To make a preference prediction for any user, collaborative filtering uses a preference by other users of similar interests and predicts movies of your interests, that are unknown to you. Spark MLlib uses Alternate Least Squares (ALS) to make a recommendation. Here is a glimpse of a collaborative filtering method used in the ALS algorithm:
Table 1 – User-movie matrix
Users | M1 | M2 | M3 | M4 |
U1 | 2 | 4 | 3 | 1 |
U2 | 0 | 0 | 4 | 4 |
U3 | 3 | 2 | 2 | 3 |
U4 | 2 | ? | 3 | ? |
In the preceding table, user ratings on movies are represented as a matrix (that is, a user-item matrix), where a cell represents ratings for a particular movie by a user. The cell with ? represents the movies user U4 is not aware of or hasn't seen. Based on the ...