0
0
ML Pythonml~20 mins

Collaborative filtering in ML Python - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Collaborative Filtering Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding User-Based Collaborative Filtering

In user-based collaborative filtering, how are recommendations typically generated?

ABy analyzing item features and recommending items with similar attributes
BBy clustering items and recommending items from the largest cluster
CBy randomly selecting popular items from the dataset
DBy finding users similar to the target user and recommending items they liked
Attempts:
2 left
💡 Hint

Think about how users' preferences help suggest new items.

Predict Output
intermediate
2:00remaining
Output of Cosine Similarity Calculation

What is the output of the following Python code that calculates cosine similarity between two user rating vectors?

ML Python
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))
A0.85
B1.00
C0.97
D0.75
Attempts:
2 left
💡 Hint

Calculate dot product and norms carefully.

Model Choice
advanced
2:00remaining
Choosing the Best Collaborative Filtering Model for Sparse Data

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?

AItem-based collaborative filtering with cosine similarity
BMatrix factorization techniques like Singular Value Decomposition (SVD)
CRandom recommendation based on item popularity
DUser-based collaborative filtering using simple nearest neighbors
Attempts:
2 left
💡 Hint

Consider methods that can learn latent features from sparse data.

Hyperparameter
advanced
2:00remaining
Effect of Number of Latent Factors in Matrix Factorization

In matrix factorization for collaborative filtering, what is the effect of increasing the number of latent factors (dimensions)?

AIt can improve accuracy but may cause overfitting if too large
BIt always improves model accuracy without any downside
CIt reduces model complexity and speeds up training
DIt has no effect on the model's performance
Attempts:
2 left
💡 Hint

Think about model complexity and generalization.

Metrics
expert
2:00remaining
Evaluating Collaborative Filtering with RMSE

You trained a collaborative filtering model and computed the Root Mean Squared Error (RMSE) on a test set. Which statement about RMSE is correct?

AA lower RMSE means the model's predictions are closer to actual ratings
BRMSE measures how many recommendations are correct
CA higher RMSE indicates better model performance
DRMSE is not suitable for rating prediction tasks
Attempts:
2 left
💡 Hint

Recall what RMSE measures in prediction tasks.