I am trying to build a simple CF-recommender system using the small MovieLens data set. In order to do this, I tried to use ALS to factor my (user, item) matrix $A$ into a (user, latent-space) matrix $U$ and a (item, latent-space) matrix $V$ such that: $$A = UV$$ To do this I am using the ALS algorithm as defined in the Implicit package for python, which when I multiply $UV$, is wildly different from my initial $A$. My question is, am I confused about what ALS actually is? I thought it was something akin to SVD, or any other matrix factorization algorithm. Would It matter that i'm using explicit data instead of implicit data? Here is the code i'm using to perform the matrix decomposition:

from implicit.als import AlternatingLeastSquares
from scipy import sparse

def matrix_decomposition(matrix, k, i):
    matrix = sparse.csr_matrix(matrix.T)
    model = AlternatingLeastSquares(factors=k, iterations=i)
    user_latent = model.user_factors
    item_latent = model.item_factors

    return user_latent, item_latent

... I confused about what ALS actually is? I thought it was something akin to SVD, or any other matrix factorization algorithm. Would It matter that i'm using explicit data instead of implicit data?

See: "Simple Movie Recommender Using SVD" and "ALS Implicit Collaborative Filtering":

"Implicit vs explicit data

Explicit data is data where we have some sort of rating. Like the 1 to 5 ratings from the MovieLens or Netflix dataset. Here we know how much a user likes or dislikes an item which is great, but this data is hard to come by. Your users might not spend the time to rate items or your app might not work well with a rating approach in the first place.

Implicit data (the type of data we’re using here) is data we gather from the users behaviour, with no ratings or specific actions needed. It could be what items a user purchased, how many times they played a song or watched a movie, how long they’ve spent reading a specific article etc. The upside is that we have a lot more of this data, the downside is that it’s more noisy and not always apparent what it means.

For example, with star ratings we know that a 1 means the user did not like that item and a 5 that they really loved it. With song plays it might be that the user played a song and hated it, or loved it, or somewhere in-between. If they did not play a song it might be since they don’t like it or that they would love it if they just knew about.

So instead we focus on what we know the user has consumed and the confidence we have in whether or not they like any given item. We can for example measure how often they play a song and assume a higher confidence if they’ve listened to it 500 times vs. one time.

Implicit recommendations are becoming an increasingly important part of many recommendation systems as the amount of implicit data grows. For example the original Netflix challenge focused only on explicit data but they’re now relying more and more on implicit signals. The same thing goes for Hulu, Spotify, Etsy and many others.".

There are different ways to factor a matrix, like Singular Value Decomposition (SVD) or Probabilistic Latent Semantic Analysis (PLSA) if we’re dealing with explicit data.

A least squares approach in it’s basic forms means fitting some line to the data, measuring the sum of squared distances from all points to the line and trying to get an optimal fit for missing points.

With the alternating least squares approach we use the same idea but iteratively alternate between optimizing U and fixing V and vice versa. It is an iterative optimization process where we for every iteration try to arrive closer and closer to a factorized representation of our original data.

Singular-Value Decomposition is a matrix decomposition method for reducing a matrix to its constituent parts in order to make certain subsequent matrix calculations simpler.

The tutorials in the first two and last link should be very helpful.

  • 1
    $\begingroup$ would If I could, but don't quite have the reputation yet. Will do when I get enough $\endgroup$ Jul 9 '18 at 17:18

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .