Matrix factorization is the backbone of modern recommender systems (popularized by the Netflix Prize). It approximates the user-item rating matrix as a product of two low-rank matrices: user factors U and item factors V. Each user and item is represented by a latent vector, and the predicted rating is their dot product.
Given a user latent vector U, an item latent vector V, a known rating r, a learning rate lr, and a regularization strength reg, perform one step of stochastic gradient descent to update both vectors.
Both U and V must be updated using their original (pre-update) values.
Return [U_new, V_new], with both vectors rounded to four decimals.
Input: U = [1, 0], V = [0, 1], r = 5, lr = 0.1, reg = 0
Output: [[1.0, 0.5], [0.5, 1.0]]
Explanation: The zero dot product gives error 5, and both vectors are updated from their original values.
Input: U = [0.5, 0.3], V = [0.4, 0.6], r = 4, lr = 0.01, reg = 0.02
Output: [[0.5144, 0.3217], [0.418, 0.6107]]
Compute the rating error from the original vectors before either update.
Build both new vectors from the original U and V, then round each coordinate.
Sign in to take notes on this problem
Accepts: array
Accepts: array
Accepts: number
Accepts: number
Accepts: number
Matrix factorization is the backbone of modern recommender systems (popularized by the Netflix Prize). It approximates the user-item rating matrix as a product of two low-rank matrices: user factors U and item factors V. Each user and item is represented by a latent vector, and the predicted rating is their dot product.
Given a user latent vector U, an item latent vector V, a known rating r, a learning rate lr, and a regularization strength reg, perform one step of stochastic gradient descent to update both vectors.
Both U and V must be updated using their original (pre-update) values.
Return [U_new, V_new], with both vectors rounded to four decimals.
Input: U = [1, 0], V = [0, 1], r = 5, lr = 0.1, reg = 0
Output: [[1.0, 0.5], [0.5, 1.0]]
Explanation: The zero dot product gives error 5, and both vectors are updated from their original values.
Input: U = [0.5, 0.3], V = [0.4, 0.6], r = 4, lr = 0.01, reg = 0.02
Output: [[0.5144, 0.3217], [0.418, 0.6107]]
Compute the rating error from the original vectors before either update.
Build both new vectors from the original U and V, then round each coordinate.
Sign in to take notes on this problem
Accepts: array
Accepts: array
Accepts: number
Accepts: number
Accepts: number