In the previous section, we wanted to decompose our ratings matrix into two low-rank matrices in order to discover the intangible latent factors that drive consumers' decisions. One matrix maps the users' affinities for the discovered factors and the other maps the items' rankings on those factors.
So, let's look at how this can be implemented in Python. We've two files, als.py and example_als_recommender. Let's see our als.py file. In the last section, we saw the item-to-item collaborative filter; ALS is very similar. It's going to implement RecommenderMixin:
def __init__(self, R, factors=0.25, n_iter=10, lam=0.001,
random_state=None):
We have several parameters for ALS. The first one, and the only non-optional one, is R, our ratings matrix. In some of the math we've seen, we've referred to this interchangeably...