## Simon Funk's Matrix Factorization

We implemented the well-known matrix factorization algorithm as proposed by Simon Funk.

Matrix factorization methods are used in recommender systems to derive a set of latent factors, from the original user-item rating matrix, to characterize both users and items by these vectors of user and item factors. The user-item interaction is modeled as the inner product of the latent factors space. Accordingly each item i will be associated with a vector factor V_i, and each user u is associated with a vector factors U_u. An approximation of the rating of a user \(u\) on an item \(i\) can be derived as the
inner product of their item and user factor vectors.

The rrecsys package utilizes a stochastic gradient descent optimization technique for computing the item and user factors. The U(user) and V(item) factor matrices are cropped to k features. Each feature is trained until convergence.

For the Rating Prediction task, to train a model with this algorithm, it is required to define an additional argument, *k* the number of user/item factors.

```
data("ml100k")
d <- defineData(ml100k)
e <- evalModel(d, folds = 2)
mf_model <- evalPred(e, "funk", k = 10, steps = 100, regCoef = 0.0001, learningRate = 0.001, biases = F)
mf_model
```

For the Item Recommendation task, to provide item recommendations, it is required to define two additional arguments, *positiveThreshold* the threshold for “positive” ratings, and the *topN* the number of recommended items.

```
data("ml100k")
d <- defineData(ml100k)
e <- evalModel(d, folds = 2)
mf <- evalRec(e, "funk", k = 10, steps = 100, regCoef = 0.0001, learningRate = 0.001, biases = F, positiveThreshold = 3, topN = 3)
mf
```

The *k* default value is 10.
The *positiveThreshold* default value is 3.
The *topN* default value is 3.
The *learningRate* default value is 0.001.
The *regCoef* default value is 0.0001.
The *steps* default value is 10.