made by onur

This site is open source. View on GitHub

Recommender Systems — Similarity & Prediction

6 tasks · 12 pts max · no time limit

← Back

Scenario

Part A — Collaborative Filtering Prediction

Active user ā has mean rating rˉa=3.6\bar{r}_a = 3.6rˉa​=3.6. Three neighbours:

NeighbourSimilarity w(a,i)w(a,i)w(a,i)Deviation ri,j−rˉir_{i,j} - \bar{r}_iri,j​−rˉi​
U10.80+1.5
U20.40−2.0
U3−0.60−1.0

Prediction formula: pred(a,j)=rˉa+g∑iw(a,i) (ri,j−rˉi)pred(a,j) = \bar{r}_a + g\sum_i w(a,i)\,(r_{i,j} - \bar{r}_i)pred(a,j)=rˉa​+g∑i​w(a,i)(ri,j​−rˉi​), where g=1/∑i∣w(a,i)∣g = 1/\sum_i |w(a,i)|g=1/∑i​∣w(a,i)∣.

Part B — Evaluation Metrics

A model produced the following predictions on five held-out ratings:

ItemPredictedActual
i14.03.5
i22.54.0
i33.03.0
i45.03.5
i52.03.0

MAE=1n∑i∣pi−ri∣,MSE=1n∑i(pi−ri)2\text{MAE} = \frac{1}{n}\sum_i|p_i - r_i|, \quad \text{MSE} = \frac{1}{n}\sum_i(p_i - r_i)^2MAE=n1​∑i​∣pi​−ri​∣,MSE=n1​∑i​(pi​−ri​)2

Part C — Cosine Similarity

Two users' rating vectors across 4 items: A = [2, 0, 3, 1] and B = [1, 2, 2, 0].

sim(A,B)=a⋅b∥a∥ ∥b∥sim(A,B) = \frac{\mathbf{a}\cdot\mathbf{b}}{\|\mathbf{a}\|\,\|\mathbf{b}\|}sim(A,B)=∥a∥∥b∥a⋅b​

Task 1: Using all three neighbours, compute the weighted deviation sum Σ w(a,i)(rᵢⱼ − r̅ᵢ).

Choose one

Or enter your answer (±2% tolerance)

Task 2: Compute the normalising factor g = 1 / Σ|w(a,i)| (round to 3 decimal places).

Choose one

Or enter your answer (±2% tolerance)

Task 3: Compute the predicted rating pred(a, j) (round to 3 decimal places).

Choose one

Or enter your answer (±2% tolerance)

Task 4: Calculate the MAE (Mean Absolute Error) for the five predictions in Part B.

Choose one

Or enter your answer (±2% tolerance)

Task 5: Calculate the MSE (Mean Squared Error) for the five predictions in Part B.

Choose one

Or enter your answer (±2% tolerance)

Task 6: Compute the cosine similarity sim(A, B) between A = [2, 0, 3, 1] and B = [1, 2, 2, 0] (round to 3 decimal places).

Choose one

Or enter your answer (±2% tolerance)