Skip to content
CoreSource checked

Matrix Factorization

Approximates a data matrix as a product of lower-dimensional latent factor matrices.

Quick Facts

Compact metadata for implementation and discovery.

Category
Machine Learning
Difficulty
Intermediate
Family
Latent Factor Models
Tier
Core
Status
Verified
Review
Source Checked
Sources
1
Formulas
0
Relationships
4
Code example
Ready
Visualization
Ready

Overview

Matrix factorization learns latent row and column representations whose product reconstructs observed entries. It is often trained by minimizing reconstruction error on known values while regularizing the factors.

Core Concepts

recommendation modelinglatent factor modelsfactorizationmachine learning

Quick facts

Complexity

Runtime and memory behavior at a glance.

Best

O(k)

Average

O(k^2)

Worst

O(k^3)

Space

O(k)

When to Use

  • Use when interactions are sparse but low-rank structure is plausible.
  • Use when latent factors are useful for prediction or compression.

When Not to Use

  • Avoid when missing entries are not missing at random and bias is unmodeled.
  • Avoid when cold-start rows or columns have no observations.

What It Does

  • Represents rows and columns with latent vectors
  • Predicts entries from vector dot products
  • Optimizes factors against observed data

Use Cases

  • Collaborative filtering and recommender systems
  • Low-rank approximation
  • Imputing missing matrix entries under a latent-factor model

Inputs

  • Sparse observed interaction matrix R (users × items)
  • Latent rank k, learning rate η, and regularization λ

Outputs

  • Low-rank factor matrices U (m × k) and V (n × k)
  • Completed dense score predictions R_hat = U V^T

Pseudocode

  1. 1.Initialize row and column factor matrices
  2. 2.For each observed entry
  3. 3.Predict the entry from the factor dot product
  4. 4.Compute reconstruction error
  5. 5.Update both factor vectors with regularization
  6. 6.Validate predictions on held-out observed entries

Canonical Example

Input
ratings for users U1,U2 and items I1,I2 with one missing rating
Output
latent user/item vectors and a predicted missing rating
Explanation
The model fits vectors so known dot products match observed ratings and then predicts the missing entry.

Implementation Notes

  • Split observed entries into train and validation sets.
  • Initialize factors with small random values or a stable decomposition.
  • Track reconstruction loss and regularization separately.

Common Pitfalls

  • Evaluating on training entries hides overfitting.
  • Unregularized factors can memorize sparse observations.
  • Scale and bias terms should be handled consistently.

Interactive Mechanism Walkthrough

Iterative Convergence & State Trajectory

Show decomposing an observed matrix into low-rank latent factors on a small recommendation modeling example.

Matrix Factorization mechanism walkthrough step 1 of 6x₀x₁x₂x*
Step 1 of 6: Initialize row and column factor matrices
machine-learning-mechanism

Notes

Matrix factorization is a modeling assumption; validation should check whether low-rank structure actually helps.

Sources (1)

What each reference supports for this entry.

Matrix Factorization Techniques for Recommender Systems

Paper

Reference for low-rank matrix factorization with user and item latent factors in recommendation.

Open source

Explore Next

Good next jumps from the relationship graph, ranked for useful discovery.

Conceptual neighborPrincipal Component Analysis

Both use low-dimensional linear structure, but matrix factorization often handles sparse observed entries.

Large matrix-factorization models are often trained with stochastic gradient updates.

Tags

Machine LearningLinear Algebra