ALS (Matrix Factorization)
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
Hyperparameter tuning
factors: Number of latent factors in the matrix factorization.regularization: Regularization parameter to prevent overfitting.bm25: Whether to use BM25 weighting scheme.bm25_k1: BM25 coefficient for item frequency factor.bm25_b: BM25 coefficient for document length factor.use_features: Whether to use entity features in the model.
V1 API
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)
Usage
Use this model when:
- You have implicit feedback data (clicks, views, purchases) rather than explicit ratings
- You need a simple, interpretable collaborative filtering approach
- You want to learn item-item similarity from user interaction patterns
- You have a large dataset and need efficient training
- You're building a baseline model before trying more complex approaches
Choose a different model when:
- You have rich item metadata or text features that you want to leverage (use Two-Tower or BeeFormer instead)
- You need to model sequential patterns or temporal dependencies (use sequential models like SASRec)
- You have very sparse data with limited interactions per user/item
- You need the highest possible accuracy and can invest in more complex models
Use cases
- E-commerce product recommendations (clothing, electronics, books)
- Content recommendations (articles, videos, music)
- App recommendations
- General collaborative filtering scenarios with implicit feedback
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).