Search Knowledge

© 2026 LIBREUNI PROJECT

Machine Learning / MLOps & System Deployment

Recommender Systems

Recommender Systems

Recommender systems suggest items to users based on historical interaction patterns and profile attributes.

Collaborative Filtering

Collaborative filtering recommends items based on the behavior of similar users.

Cosine Similarity

We measure the similarity between user rating vectors u\mathbf{u} and v\mathbf{v} via:

Sim(u,v)=uvuv\text{Sim}(\mathbf{u}, \mathbf{v}) = \frac{\mathbf{u} \cdot \mathbf{v}}{||\mathbf{u}|| ||\mathbf{v}||}

Predictions are weighted averages of ratings from similar users.

Matrix Factorization (Latent Factor Models)

Matrix Factorization decomposes the sparse user-item rating matrix RR of shape (m,n)(m, n) into two lower-rank matrices: PP of shape (m,k)(m, k) and QQ of shape (n,k)(n, k), representing user and item latent factor embeddings:

RPQTR \approx P Q^T

We find matrices PP and QQ by minimizing the squared error over observed ratings, applying regularization to prevent overfitting:

minP,Q(u,i)K(rui(μ+bu+bi+puTqi))2+λ(pu2+qi2)\min_{P, Q} \sum_{(u,i) \in K} (r_{ui} - (\mu + b_u + b_i + \mathbf{p}_u^T \mathbf{q}_i))^2 + \lambda (||\mathbf{p}_u||^2 + ||\mathbf{q}_i||^2)

where KK is the set of user-item pairs with observed ratings, μ\mu is the global average rating, and bu,bib_u, b_i are user and item bias parameters. Biases isolate systematic offsets (e.g., users who always rate critically, or items that are universally liked).

Cold Start Problem

Latent factor models struggle when a new user or item joins because interaction data is missing. Hybrid systems mitigate this by utilizing content metadata (e.g., genre, age).

Example: Computing Embedding Similarity

The following example demonstrates calculating the cosine similarity between item latent embeddings:

python

Interactive Lab

Calculate the cosine similarity between item latent factor vectors (embeddings) to evaluate collaborative recommendation links.

Step 1
Inspect the idea
Step 2
Edit the program
Step 3
Run and compare

Exercise

Test your understanding of matrix factorization limits:

Why are biases (user bias and item bias) typically added to the prediction formula in Matrix Factorization?

Regularization

The L2 regularizer parameter λ\lambda prevents user/item embedding parameters from growing too large during updates, mitigating overfitting.

References & Further Reading