Predictable is a Ruby DSL for Prediction.io, an open source machine learning server built on top of Hadoop. It makes it easy to implement predictive features such as personalization, recommendations, and content discovery in your Ruby/Rails application.
Add this line to your application's Gemfile:
gem 'predictable'
And then execute:
$ bundle
Or install it yourself as:
$ gem install predictable
Include Predictable::User in your application's User model.
class User < ActiveRecord::Base
include Predictable::User
...
end
Include the Predictable::Item in the models of the items you want to recommend.
class Offer < ActiveRecord::Base
include Predictable::Item
...
end
Get 10 recommended items for a user.
Offer.recommended_for(user, 10)
Get 10 items most similar to an existing item.
Offer.similar_to(offer, 10)
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request