In user-based collaborative filtering, how are recommendations typically generated?
Think about how users' preferences help suggest new items.
User-based collaborative filtering finds users with similar tastes and recommends items those similar users liked but the target user hasn't seen yet.
What is the output of the following Python code that calculates cosine similarity between two user rating vectors?
import numpy as np from numpy.linalg import norm user1 = np.array([4, 0, 3, 5]) user2 = np.array([5, 1, 2, 5]) cos_sim = np.dot(user1, user2) / (norm(user1) * norm(user2)) print(round(cos_sim, 2))
Calculate dot product and norms carefully.
The cosine similarity is the dot product of the vectors divided by the product of their magnitudes. The result rounds to 0.97.
You have a very sparse user-item rating matrix with many missing values. Which collaborative filtering approach is generally better suited to handle this sparsity?
Consider methods that can learn latent features from sparse data.
Matrix factorization methods like SVD can learn latent factors and handle sparsity better than neighborhood methods, which rely on overlapping ratings.
In matrix factorization for collaborative filtering, what is the effect of increasing the number of latent factors (dimensions)?
Think about model complexity and generalization.
Increasing latent factors allows the model to capture more complex patterns but risks overfitting if the number is too high relative to data size.
You trained a collaborative filtering model and computed the Root Mean Squared Error (RMSE) on a test set. Which statement about RMSE is correct?
Recall what RMSE measures in prediction tasks.
RMSE measures the average magnitude of prediction errors; lower values mean predictions are closer to true ratings.