Starting from:

$30

Artificial Intelligence: Homework 4

CS 541 Artificial Intelligence: Homework 4

This assignment is dedicated to helping you understand GD and recommender systems. You need to download the ml-latest-small.zip at https://grouplens.org/datasets/movielens/
1 Data Set
Note that the zip file contains side information (e.g. tag applications) that will not be used in the project: we
consider only the ratings from the users. Therefore, the first step is to pre-process the data, and organize all
the users’ ratings as a matrix. Suppose there are n users and p movies. Then the size of the rating matrix M
is n × p. Let us denote the index set of observed entries by Ω.
The second step is to divide Ω into two sets Ω1 and Ω2: Ω1 for training and Ω2 for testing. To this end, we
randomly choose 90 percent of entries in Ω to form Ω1, and Ω2 consists of the remaining.
2 Learning
Then you will have to solve the following non-convex program to learn the prediction matrix:
min
U,V
F(U, V ) := 1
2
X
(i,j)∈Ω1
(Mij − uiv
>
j
)
2 +
λ
2

kUk
2
F + kV k
2
F

(1)
where Mij is the (i, j)th entry of M, ui and vj are the ith and jth row of U and V respectively.
1. Derive the gradient ∂F(U,V )
∂U and ∂F(U,V )
∂V .
2. Suppose λ = 1. Describe the update rule of GD and implement it with Python. You can randomly
initialize all ui and vj . Note that you need to carefully choose the learning rate.
3. Plot the objective value against the number of iterations, and summarize your findings.
1
3 Evaluation
After we terminate GD, we will obtain the solution U, V . Our prediction matrix X is then given by X =
UV >. We evaluate the performance of our prediction matrix X by root-mean-square error (RMSE):
RMSE :=
vuut
1
|Ω2|
X
(i,j)∈Ω2
(Mij − Xij )
2.
1. Record the RMSE for the choice λ = 1.
2. Now pick λ from {10−6
, 10−3
, 0.1, 0.5, 2, 5, 10, 20, 50, 100, 500, 1000}. For each value, learn and
evaluate your model. Plot RMSE against λ and summarize your findings.
2

More products