README.md in disco-0.2.6 vs README.md in disco-0.2.7

- old
+ new

@@ -33,21 +33,19 @@ ]) ``` > IDs can be integers, strings, or any other data type -If users don’t rate items directly (for instance, they’re purchasing items or reading posts), this is known as implicit feedback. Leave out the rating, or use a value like number of purchases, number of page views, or time spent on page: +If users don’t rate items directly (for instance, they’re purchasing items or reading posts), this is known as implicit feedback. Leave out the rating. ```ruby recommender.fit([ - {user_id: 1, item_id: 1, value: 1}, - {user_id: 2, item_id: 1, value: 1} + {user_id: 1, item_id: 1}, + {user_id: 2, item_id: 1} ]) ``` -> Use `value` instead of `rating` for implicit feedback - Get user-based recommendations - “users like you also liked” ```ruby recommender.user_recs(user_id) ``` @@ -104,15 +102,14 @@ group(:user_id). group("properties->>'post_id'"). # postgres syntax count data = - views.map do |(user_id, post_id), count| + views.map do |(user_id, post_id), _| { user_id: user_id, - item_id: post_id, - value: count + item_id: post_id } end ``` Create a recommender and get recommended posts for a user @@ -199,11 +196,11 @@ ```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) +Alternatively, you can store only the factors and use a library like [Neighbor](https://github.com/ankane/neighbor). See the [examples](https://github.com/ankane/neighbor/tree/master/examples). ## Algorithms Disco uses high-performance matrix factorization. @@ -280,26 +277,26 @@ ``` Speed up the `user_recs` method with: ```ruby -model.optimize_user_recs +recommender.optimize_user_recs ``` Speed up the `item_recs` method with: ```ruby -model.optimize_item_recs +recommender.optimize_item_recs ``` Speed up the `similar_users` method with: ```ruby -model.optimize_similar_users +recommender.optimize_similar_users ``` -This should be called after fitting or loading the model. +This should be called after fitting or loading the recommender. ## Reference Get ids @@ -333,9 +330,31 @@ Thanks to: - [LIBMF](https://github.com/cjlin1/libmf) for providing high performance matrix factorization - [Implicit](https://github.com/benfred/implicit/) for serving as an initial reference for user and item similarity - [@dasch](https://github.com/dasch) for the gem name + +## Upgrading + +### 0.2.7 + +There’s now a warning when passing `:value` with implicit feedback, as this has no effect on recommendations and can be removed. Earlier versions of the library incorrectly stated this was used. + +```ruby +recommender.fit([ + {user_id: 1, item_id: 1, value: 1}, + {user_id: 2, item_id: 1, value: 3} +]) +``` + +to: + +```ruby +recommender.fit([ + {user_id: 1, item_id: 1}, + {user_id: 2, item_id: 1} +]) +``` ## History View the [changelog](https://github.com/ankane/disco/blob/master/CHANGELOG.md)