Skip to content

Commit

Permalink
Corrected bug in SlopeOne and added benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasHug committed Dec 15, 2016
1 parent 05ef86a commit ab67f40
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ GHz, 4Go RAM.
| [KNNBaseline](http://surprise.readthedocs.io/en/latest/knn_inspired.html#surprise.prediction_algorithms.knns.KNNBaseline) | .9306 | .7334 | 44 |
| [SVD](http://surprise.readthedocs.io/en/latest/matrix_factorization.html#surprise.prediction_algorithms.matrix_factorization.SVD) | .9392 | .7409 | 46 |
| [SVD++](http://surprise.readthedocs.io/en/latest/matrix_factorization.html#surprise.prediction_algorithms.matrix_factorization.SVDpp) | .9200 | .7253 | 31min |
| [Slope One](http://surprise.readthedocs.io/en/latest/slope_one.html#surprise.prediction_algorithms.slope_one.SlopeOne) | .9454 | .7430 | 25 |


| [Movielens 1M](http://grouplens.org/datasets/movielens/1m) | RMSE | MAE | Time (min) |
Expand All @@ -152,6 +153,8 @@ GHz, 4Go RAM.
| [KNNWithMeans](http://surprise.readthedocs.io/en/latest/knn_inspired.html#surprise.prediction_algorithms.knns.KNNWithMeans) | .9292 | .7386 | 22 |
| [KNNBaseline](http://surprise.readthedocs.io/en/latest/knn_inspired.html#surprise.prediction_algorithms.knns.KNNBaseline) | .8949 | .7063 | 44 |
| [SVD](http://surprise.readthedocs.io/en/latest/matrix_factorization.html#surprise.prediction_algorithms.matrix_factorization.SVD) | .8936 | .7057 | 7 |
| [Slope One](http://surprise.readthedocs.io/en/latest/slope_one.html#surprise.prediction_algorithms.slope_one.SlopeOne) | .9065 | .7144 | 8 |


Documentation, Getting Started
------------------------------
Expand Down
3 changes: 2 additions & 1 deletion surprise/prediction_algorithms/slope_one.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class SlopeOne(AlgoBase):
# i and j).
Ri = [j for (j, _) in self.trainset.ur[u] if self.freq[i, j] > 0]
est = self.user_mean[u]
est += sum(self.dev[i, j] for j in Ri) / len(Ri)
if Ri:
est += sum(self.dev[i, j] for j in Ri) / len(Ri)

return est

0 comments on commit ab67f40

Please sign in to comment.