Skip to main content

ALS (Matrix Factorization)

warning

This is an article from the Shaped 1.0 documentation. The APIs have changed and information may be outdated. Go to Shaped 2.0 docs

Description

The ALS (Alternating Least Squares) policy implements matrix factorization for collaborative filtering, particularly well-suited for implicit feedback datasets. It decomposes the user-item interaction matrix into user and item latent factor matrices (P and Q) by iteratively solving regularized least squares problems, alternating between fixing P and solving for Q, then fixing Q and solving for P. It commonly incorporates confidence weighting (like BM25 or a linear weighting scheme) to handle implicit feedback where observed interactions have higher confidence than unobserved ones.

Policy Type: als Supports: embedding_policy, scoring_policy

Configuration Example

policy_configs:
embedding_policy: # Can also be used under scoring_policy
policy_type: als
factors: 64 # Number of latent factors (embedding dimension)
regularization: 0.1 # Regularization parameter (lambda)
iterations: 15 # Number of ALS iterations
# Implicit Feedback Handling
bm25: true # Whether to use BM25 weighting (alternative: simple alpha weighting)
bm25_k1: 1.2 # BM25 k1 parameter (if bm25=true)
bm25_b: 0.75 # BM25 b parameter (if bm25=true)

Reference

  • Hu, Y., Koren, Y., & Volinsky, C. (2008). Collaborative Filtering for Implicit Feedback Datasets. ICDM.
  • Takács, G., et al. (2011). Applications of the Stochastic Gradient Descent Method for Matrix Factorization in Recommendation Systems. RecSys. (Though ALS is distinct, SGD is another common MF solver).