Simon Funk's Netflix-prize model predicts a rating as and fits it by stochastic gradient descent on the regularised squared error.
funk_svd(triples, n_users, n_items, lr, lam, n_epochs, U0, V0): triples is a list of (u, i, y) observed ratings; U0 (n_users, K) and V0 (n_items, K) are the initial factors (copy them). Set to the mean of all observed ratings (kept fixed) and all biases to . For each epoch, visit the triples in the given order; for each, compute with the current parameters and apply the updates below simultaneously (every right-hand side uses the values from before this update):
Return (mu, b, c, U, V) with mu a float and the rest arrays.
predict(model, users, items): the predictions for paired lists of users and items, where model is the tuple returned above.
rmse(model, triples): the root mean squared error over the triples, as a Python float.