Skip to content

Commit

Permalink
some more doc, added tests for SlopeOne
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasHug committed Dec 15, 2016
1 parent 9e7dc64 commit 05ef86a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,27 @@ following purposes in mind**:
At the moment, the available prediction algorithms are:

- [NormalPredictor](http://surprise.readthedocs.io/en/latest/basic_algorithms.html#surprise.prediction_algorithms.random_pred.NormalPredictor):
An algorithm predicting a random rating based on the distribution of the
an algorithm predicting a random rating based on the distribution of the
training set, which is assumed to be normal.
- [BaselineOnly](http://surprise.readthedocs.io/en/latest/basic_algorithms.html#surprise.prediction_algorithms.baseline_only.BaselineOnly):
An agorithm predicting the baseline estimate for given user and item.
an agorithm predicting the baseline estimate for given user and item.
- [KNNBasic](http://surprise.readthedocs.io/en/latest/knn_inspired.html#surprise.prediction_algorithms.knns.KNNBasic):
A basic collaborative filtering algorithm.
a basic collaborative filtering algorithm.
- [KNNWithMeans](http://surprise.readthedocs.io/en/latest/knn_inspired.html#surprise.prediction_algorithms.knns.KNNWithMeans):
A basic collaborative filtering algorithm, taking into account the mean
a basic collaborative filtering algorithm, taking into account the mean
ratings of each user.
- [KNNBaseline](http://surprise.readthedocs.io/en/latest/knn_inspired.html#surprise.prediction_algorithms.knns.KNNBaseline):
A basic collaborative filtering algorithm taking into account a baseline
a basic collaborative filtering algorithm taking into account a baseline
rating.
- [SVD](http://surprise.readthedocs.io/en/latest/matrix_factorization.html#surprise.prediction_algorithms.matrix_factorization.SVD)
and
[PMF](http://surprise.readthedocs.io/en/latest/matrix_factorization.html#unbiased-note):
The famous SVD algorithm, as popularized by Simon Funk during the Netflix
the famous SVD algorithm, as popularized by Simon Funk during the Netflix
Prize. The unbiased version is equivalent to Probabilistic Matrix
Factorization.
- [SVD++](http://surprise.readthedocs.io/en/latest/matrix_factorization.html#surprise.prediction_algorithms.matrix_factorization.SVDpp):
An extension of SVD taking into account implicite ratings.
an extension of SVD taking into account implicite ratings.
- [Slope One](http://surprise.readthedocs.io/en/latest/slope_one.html#surprise.prediction_algorithms.slope_one.SlopeOne): a simple yet accurate collaborative filtering algorithm.


The name *SurPRISE* (roughly :) ) stands for Simple Python RecommendatIon
Expand Down
4 changes: 2 additions & 2 deletions surprise/prediction_algorithms/slope_one.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ class SlopeOne(AlgoBase):
.. math::
\hat{r}_{ui} = \\mu_u + \\frac{1}{
|R_i(u)|}
\\sum\\limits_{j \in R_i(u)} \\text{dev}(i, j).
\\sum\\limits_{j \in R_i(u)} \\text{dev}(i, j),
where :math:`R_i(u)` is the set of relevents items, i.e. the set of items
:math:`j` rated by :math:`u` that also have at least one common user with
:math:`i`. :math:`\\text{dev}_(i, j)` is defined as the average difference
between the ratings of :math:`i` and :math`j`:
between the ratings of :math:`i` and those of :math:`j`:
.. math::
\\text{dev}(i, j) = \\frac{1}{
Expand Down
3 changes: 2 additions & 1 deletion tests/test_algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from surprise.prediction_algorithms import KNNBaseline
from surprise.prediction_algorithms import SVD
from surprise.prediction_algorithms import SVDpp
from surprise.prediction_algorithms import SlopeOne
from surprise.dataset import Dataset
from surprise.dataset import Reader

Expand All @@ -33,7 +34,7 @@ def test_unknown_user_or_item():
pass # just need trainset and testset to be set

klasses = (NormalPredictor, BaselineOnly, KNNBasic, KNNWithMeans,
KNNBaseline, SVD, SVDpp)
KNNBaseline, SVD, SVDpp, SlopeOne)
for klass in klasses:
algo = klass()
algo.train(trainset)
Expand Down

0 comments on commit 05ef86a

Please sign in to comment.