## Simon Funk's SVD

We implemented the basic but popular SVD algorithm by Simon Funk. The dimensionality of the user-item matrix is reduced to the k strongest signals using the stochastic gradient descent optimization technique. Each feature weight in the $$users \times k$$ and $$k \times items$$ matrices are updated until the preset convergence criteria is met. Implementing FunkSVD in R turned out to be quite challenging due to the algorithm's structure with nested loops and R's inability to perform well under this circumstance. Since R supports array programming and performs very well under it, we kept the structure of the algorithm but vectorized as much as possible update loops.

To train a model using this algorithm:

svd <- rrecsys(smallML, "FunkSVD", k = 10, gamma = .015, lambda = .001)

## Feature: 1 / 10  trained. Time: 1.822208 seconds.
## Feature: 2 / 10  trained. Time: 0.1505978 seconds.
## Feature: 3 / 10  trained. Time: 0.1385911 seconds.
## Feature: 4 / 10  trained. Time: 0.1450992 seconds.
## Feature: 5 / 10  trained. Time: 0.1876249 seconds.
## Feature: 6 / 10  trained. Time: 0.178616 seconds.
## Feature: 7 / 10  trained. Time: 0.175616 seconds.
## Feature: 8 / 10  trained. Time: 0.1691129 seconds.
## Feature: 9 / 10  trained. Time: 0.141093 seconds.
## Feature: 10 / 10  trained. Time: 0.1430929 seconds.

svd

## The model was trained on the dataset using  FunkSVD algorithm.
## The algorithm was configured with the following parameters:
##    k gamma lambda
## 1 10 0.015  0.001


k is he number of features, gamma the regularization term and lambda the learning rate. The above call is configured to the default values.

The returned object is of type SVDclass.