README.md in disco-0.2.4 vs README.md in disco-0.2.5
- old
+ new
@@ -199,10 +199,12 @@
```ruby
bin = File.binread("recommender.bin")
recommender = Marshal.load(bin)
```
+Alternatively, you can store only the factors and use a library like [Neighbor](https://github.com/ankane/neighbor)
+
## Algorithms
Disco uses high-performance matrix factorization.
- For explicit feedback, it uses [stochastic gradient descent](https://www.csie.ntu.edu.tw/~cjlin/papers/libmf/libmf_journal.pdf)
@@ -235,10 +237,20 @@
There are a number of ways to deal with this, but here are some common ones:
- For user-based recommendations, show new users the most popular items.
- For item-based recommendations, make content-based recommendations with a gem like [tf-idf-similarity](https://github.com/jpmckinney/tf-idf-similarity).
+Get top items with:
+
+```ruby
+recommender = Disco::Recommender.new(top_items: true)
+recommender.fit(data)
+recommender.top_items
+```
+
+This uses [Wilson score](https://www.evanmiller.org/how-not-to-sort-by-average-rating.html) for explicit feedback (add [wilson_score](https://github.com/instacart/wilson_score) your application’s Gemfile) and item frequency for implicit feedback.
+
## Data
Data can be an array of hashes
```ruby
@@ -255,26 +267,32 @@
```ruby
Daru::DataFrame.from_csv("ratings.csv")
```
-## Faster Similarity
+## Performance [master]
-If you have a large number of users/items, you can use an approximate nearest neighbors library like [NGT](https://github.com/ankane/ngt) to speed up item-based recommendations and similar users.
+If you have a large number of users or items, you can use an approximate nearest neighbors library like [Faiss](https://github.com/ankane/faiss) to improve the performance of certain methods.
Add this line to your application’s Gemfile:
```ruby
-gem 'ngt', '>= 0.3.0'
+gem 'faiss'
```
-Speed up item-based recommendations with:
+Speed up the `user_recs` method with:
```ruby
+model.optimize_user_recs
+```
+
+Speed up the `item_recs` method with:
+
+```ruby
model.optimize_item_recs
```
-Speed up similar users with:
+Speed up the `similar_users` method with:
```ruby
model.optimize_similar_users
```