{"id":13747607,"url":"https://github.com/davidcelis/recommendable","last_synced_at":"2025-05-15T00:07:18.966Z","repository":{"id":2273412,"uuid":"3230143","full_name":"davidcelis/recommendable","owner":"davidcelis","description":":+1::-1: A recommendation engine using Likes and Dislikes for your Ruby app","archived":false,"fork":false,"pushed_at":"2018-04-24T15:42:20.000Z","size":522,"stargazers_count":1359,"open_issues_count":18,"forks_count":114,"subscribers_count":45,"default_branch":"master","last_synced_at":"2025-04-13T20:40:55.961Z","etag":null,"topics":["rails","recommendations","redis","ruby","sidekiq"],"latest_commit_sha":null,"homepage":"http://davidcelis.github.io/recommendable/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidcelis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-01-20T21:59:40.000Z","updated_at":"2025-02-23T12:11:49.000Z","dependencies_parsed_at":"2022-07-07T15:30:23.848Z","dependency_job_id":null,"html_url":"https://github.com/davidcelis/recommendable","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidcelis%2Frecommendable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidcelis%2Frecommendable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidcelis%2Frecommendable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidcelis%2Frecommendable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidcelis","download_url":"https://codeload.github.com/davidcelis/recommendable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254249197,"owners_count":22039029,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rails","recommendations","redis","ruby","sidekiq"],"created_at":"2024-08-03T06:01:34.984Z","updated_at":"2025-05-15T00:07:13.939Z","avatar_url":"https://github.com/davidcelis.png","language":"Ruby","readme":"# Recommendable\n\nRecommendable is a gem that allows you to quickly add a recommendation engine for Likes and Dislikes to your Ruby application using my version of [Jaccardian similarity and memory-based collaborative filtering][collaborative filtering].\n\n## Requirements\n\n* Ruby \u003e= 1.9.3\n* ActiveRecord, Sequel, DataMapper, Mongoid, or MongoMapper (your models must have an `id` field)\n* [Sidekiq][sidekiq], [Resque][resque], or [DelayedJob][delayed-job] (optional but highly recommended)\n\nBundling one of the queueing systems above is highly recommended to avoid having to manually refresh users' recommendations. If you bundle [Sidekiq][sidekiq], you should also include ['sidekiq-middleware'][sidekiq-middleware] in your Gemfile to ensure that a user will not get enqueued more than once at a time. If bundling [Resque][resque], you should include ['resque-loner'][resque-loner] for this. As far as I know, there is no current way to avoid duplicate jobs in [DelayedJob][delayed-job]. Queueing for [Torquebox][torquebox] is also supported.\n\n## Installation\n\nAdd the following to your application's `Gemfile`:\n\n``` ruby\ngem 'recommendable'\n```\n\nPlease note that you currently must need to place Recommendable below your ORM and queueing system in the Gemfile. If you are using Sidekiq and ActiveRecord, please place `gem recommendable` below both `gem 'rails'` and  `gem 'sidekiq'`.\n\nAfter bundling, you should configure Recommendable. Do this somewhere after you've required it, but before it's actually used. For example, Rails users would create an initializer (`config/initializers/recommendable.rb`):\n\n```ruby\nrequire 'redis'\n\nRecommendable.configure do |config|\n  # Recommendable's connection to Redis.\n  #\n  # Default: localhost:6379/0\n  config.redis = Redis.new(:host =\u003e 'localhost', :port =\u003e 6379, :db =\u003e 0)\n\n  # A prefix for all keys Recommendable uses.\n  #\n  # Default: recommendable\n  config.redis_namespace = :recommendable\n\n  # Whether or not to automatically enqueue users to have their recommendations\n  # refreshed after they like/dislike an item.\n  #\n  # Default: true\n  config.auto_enqueue = true\n\n  # The number of nearest neighbors (k-NN) to check when updating\n  # recommendations for a user. Set to `nil` if you want to check all\n  # neighbors as opposed to a subset of the nearest ones. Set this to a lower\n  # number to improve Redis memory usage.\n  #\n  # Default: nil\n  config.nearest_neighbors = nil\n\n  # Like kNN, but also uses some number of most dissimilar users when\n  # updating recommendations for a user. Because, hey, disagreements are\n  # just as important as agreements, right? If `nearest_neighbors` is set to\n  # `nil`, this configuration is ignored. Set this to a lower number\n  # to improve Redis memory usage.\n  #\n  # Default: nil\n  config.furthest_neighbors = nil\n\n  # The number of recommendations to store per user. Set this to a lower\n  # number to improve Redis memory usage.\n  #\n  # Default: 100\n  config.recommendations_to_store = 100\nend\n```\n\nThe values listed above are the defaults. I recommend playing around with the `nearest_neighbors` setting. A higher value will provide more accurate recommendations at the cost of more time spent generating them.\n\nIf your application uses multiple ORMs, you must configure Recommendable to use the correct one. For example:\n\n```ruby\nRecommendable.configure do |config|\n  config.orm = :active_record\nend\n```\n\nImportant: in case of `active_record` with id of type `uuid`, use `:active_record_uuid`.\n\n## Usage\n\nIn your model that will be receiving recommendations:\n\n```ruby\nclass User\n  recommends :movies, :books, :minerals, :other_things\n\n  # ...\nend\n```\n\nTo ensure that users' recommendations are processed after they rate items, make sure your bundled queue system is running:\n\n```bash\n# sidekiq\n$ [bundle exec] sidekiq -q recommendable\n# resque\n$ QUEUE=recommendable [bundle exec] rake environment resque:work\n# delayed_job\n$ [bundle exec] rake jobs:work\n```\n\nThat's it! Please note, however, that currently only one model may receive recommendations.\n\nFor more details on how to use Recommendable in your application, [check out the detailed guide][recommendable] or see the [documentation][documentation].\n\n## Installing Redis\n\nRecommendable requires Redis to deliver recommendations. The collaborative filtering logic is based almost entirely on set math, and Redis is blazing fast for this.\n\n_NOTE: Your Redis database **MUST** be persistent. All ratings are stored permanently in Redis. If you're worried about Redis losing data, keep backups._\n\n### Mac OS X\n\nFor Mac OS X users, homebrew is by far the easiest way to install Redis. Make sure to read the caveats after installation!\n\n```bash\n$ brew install redis\n```\n\n### Linux\n\nFor Linux users, there is a package on apt-get.\n\n```bash\n$ sudo apt-get install redis-server\n$ redis-server\n```\n\nRedis will now be running on localhost:6379. After a second, you can hit `ctrl-\\` to detach and keep Redis running in the background.\n\n## Why not stars?\n\nI'll let Randall Munroe of [XKCD](http://xkcd.com/) take this one for me:\n\n[![I got lost and wandered into the world's creepiest cemetery, where the headstones just had names and star ratings. Freaked me out. When I got home I tried to leave the cemetery a bad review on Yelp, but as my hand hovered over the 'one star' button I felt this distant chill ...](http://imgs.xkcd.com/comics/star_ratings.png)](http://xkcd.com/1098/)\n\n## Links\n\n[![Build Status][travis-badge]][travis] [![Coverage][coveralls-badge]][coveralls] [![Climate][code-climate-badge]][code-climate] [![Dependencies][gemnasium-badge]][gemnasium] [![gittip][gittip-badge]][gittip]\n\n* Code: `git clone git://github.com/davidcelis/recommendable.git`\n* Home: \u003chttp://github.com/davidcelis/recommendable\u003e\n* Docs: \u003chttp://rubydoc.info/gems/recommendable/frames\u003e\n* Bugs: \u003chttp://github.com/davidcelis/recommendable/issues\u003e\n* Gems: \u003chttp://rubygems.org/gems/recommendable\u003e\n\n[stars]: http://davidcelis.com/blog/2012/02/01/why-i-hate-five-star-ratings/\n[sidekiq]: https://github.com/mperham/sidekiq\n[sidekiq-middleware]: https://github.com/krasnoukhov/sidekiq-middleware\n[delayed-job]: https://github.com/tobi/delayed_job\n[resque]: https://github.com/defunkt/resque\n[resque-loner]: https://github.com/jayniz/resque-loner\n[torquebox]: https://github.com/torquebox/torquebox\n[collaborative filtering]: http://davidcelis.com/blog/2012/02/07/collaborative-filtering-with-likes-and-dislikes/\n[recommendable]: http://davidcelis.github.com/recommendable/\n[documentation]: http://rubydoc.info/gems/recommendable/frames\n\n[travis]: https://travis-ci.org/davidcelis/recommendable\n[travis-badge]: http://img.shields.io/travis/davidcelis/recommendable/master.svg\n[coveralls]: https://coveralls.io/r/davidcelis/recommendable\n[coveralls-badge]: http://img.shields.io/coveralls/davidcelis/recommendable/master.svg\n[code-climate]: https://codeclimate.com/github/davidcelis/recommendable\n[code-climate-badge]: http://img.shields.io/codeclimate/github/davidcelis/recommendable.svg\n[gemnasium]: http://gemnasium.com/davidcelis/recommendable\n[gemnasium-badge]: http://img.shields.io/gemnasium/davidcelis/recommendable.svg\n[gittip]: https://gittip.com/davidcelis\n[gittip-badge]: http://img.shields.io/gittip/davidcelis.svg\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidcelis%2Frecommendable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidcelis%2Frecommendable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidcelis%2Frecommendable/lists"}