Giter Site home page Giter Site logo

coletivo's Introduction

coletivo

A simple Rails 3 recommendations engine. Coletivo uses Euclidean Distance or Pearson’s Correlation Coefficient to calculate the similarity between persons and their preferences.

Installation:

sudo gem install coletivo
rails g coletivo
rake db:migrate

Usage:

At your Rails model that represents a person (can be an User, Member, or something like that):

class User < ActiveRecord::Base
  has_own_preferences

  # ...
end

So, a person can rate things:

current_user = User.create(:name => 'Diogenes')
movie = Movie.create(:name => 'The Tourist', :year => 2010)

current_user.rate!(movie, 4.5)

And after a lot of ratings… recommendations:

Movie.find_recommendations_for(current_user) # => movies and more movies...

By default, the similarity strategy used is Euclidean Distance, but you can change that passing the strategy option:

Movie.find_recommendations_for(current_user, :strategy => :pearson)

Contributing to coletivo

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2011 Diógenes Falcão. See LICENSE.txt for further details.

coletivo's People

Contributors

diogenes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

coletivo's Issues

Mongodb support

I like to use this gem with Mongodb preferably with Mongoid, but not sure about where to start?

It's impossible to get recommendations

Hi,

first of all - THANK YOU very much for this gem and initiative to make easy-to-use recommentadtions engine!

On my test environment (3 users, 7 rankings, all user rated same two items, onw of them rated one more) geting recommendations fails to succeed:

ruby-1.9.2-p290 :007 > Medium.find_recommendations_for(u, :strategy=>:pearson) Coletivo::Models::PersonRating Load (5.1ms) SELECT person_ratings.* FROM person_ratingsWHEREperson_ratings.rateable_type= 'Medium' ArgumentError: wrong number of arguments (1 for 2) from /Users/maciej/.rvm/gems/ruby-1.9.2-p290@rails31/gems/coletivo-0.0.2/lib/coletivo/models/recommendable.rb:60:inblock in predict_highest_ratings'
from /Users/maciej/.rvm/gems/ruby-1.9.2-p290@rails31/gems/coletivo-0.0.2/lib/coletivo/models/recommendable.rb:64:in each' from /Users/maciej/.rvm/gems/ruby-1.9.2-p290@rails31/gems/coletivo-0.0.2/lib/coletivo/models/recommendable.rb:64:in collect'
from /Users/maciej/.rvm/gems/ruby-1.9.2-p290@rails31/gems/coletivo-0.0.2/lib/coletivo/models/recommendable.rb:64:in predict_highest_ratings' from /Users/maciej/.rvm/gems/ruby-1.9.2-p290@rails31/gems/coletivo-0.0.2/lib/coletivo/models/recommendable.rb:13:in find_recommendations_for'
from (irb):7`

Any ideas what can go wrong?

(Sorry, I don't have time currently, but I could try to fix this bug in next few days).

Just a quick question

Looks great and seems to work very well.From what I've seen of the code, I'm guessing this uses user-based filtering, and not item based? Correct?

Rails 4 Protected attributes Mass Assigment problem

I have been trying to use this on rails 4 but since rails 4 supports assignment to attributes only which are accessible in their model it's not working
Can you please add rails 4 compatibiity. Need it a bit urgently. Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.