ActsAsRecommendable
acts_as_recommendable Rails Plugin
This is Woc Project that was held by Openmaru
Project Page : http://winterofcode.grouphub.com/projects/1670122/project/log
Any questions/comments can be addressed to Song Chihyung, Jung Hoon Lee
Please see "MIT-LICENSE" in the top level directory of this distribution and the notices in the source files for distribution and copyright information.
Copyright (c) 2008 Chihyung, Jung Hun Lee, released under the MIT license
INSTALLATION
To install, simply run:
#script/plugin install https://woc.springloops.com/source/recommendation
You'll then need to make the ratings table. You should probably make a migration to do so, which you can do with the following command:
script/generate migration add_recommend_user script/generate migration add_recommend_rating script/generate migration add_recommend_item
Then edit the resulting migration source that it puts in db/migrate (it will be named something like 015_add_recommend_user.rb, the number at the beginning of the filename will probably be different in your instance).
The table needed by the plugin needs to be named "users" and have two columns in addition to the primary key. Also, The table named "ratings" have five columns and the table named "item" have five columns
They are:
+ users id integer name string
+ ratings id integer user_id integer item_id integer rating string ts string
+ items id integer title string
You can do this in your migration with the following code:
+user
def self.up
create_table :users do |t|
t.column :name, :string
end
end
def self.down
drop_table :users
end
+rating
def self.up
create_table :ratings do |t|
t.column :user_id, :integer
t.column :item_id, :integer
t.column :rating, :string
t.column :ts, :string
end
end
def self.down
drop_table :ratings
end
+item
def self.up
create_table :items do |t|
t.column :title, :string
end
end
def self.down
drop_table :items
end
After saving the migration run the following from the top-level directory of your rails application: $ rake migrate (rake db:migrate)
After that, you should have everything you need setup and ready to go.
It probably wouldn't hurt to run through the included unit tests quickly, but you don't have to:
$ rake test:plugins
USING THE PLUGIN
Pretty simple, really. You just need to add "acts_as_userbased_recommnedable" or "acts_as_itembased_recommendable" at the top of your ActiveRecord model, and everything should magically become available to you :)
Carefully, "acts_as_userbased_recommnedable" be included in ActiveRecord model like "User", and "acts_as_itembased_recommendable" be included in ActiveRecord model like "Item".
The Basics:
Any model that "acts_as_userbased_recommnedable" or "acts_as_itembased_recommnedable"
has the following methods available to it:
"acts_as_userbased_recommnedable"
similar_users : Find simiar users. Score that evaluatie item is simiar to each others
recommend_items : Recommend item. The recommended item is based on similarity among users.
"acts_as_itembased_recommnedable"
similar_items : Find simiar items.
Example:
ActsAsRecommendable
acts_as_recommendable Rails Plugin
This is Woc Project that was held by Openmaru
Project Page : http://winterofcode.grouphub.com/projects/1670122/project/log
Any questions/comments can be addressed to Song Chihyung, Jung Hoon Lee
Please see "MIT-LICENSE" in the top level directory of this distribution and the notices in the source files for distribution and copyright information.
Copyright (c) 2008 Chihyung, Jung Hun Lee, released under the MIT license
INSTALLATION
To install, simply run:
#script/plugin install https://woc.springloops.com/source/recommendation
You'll then need to make the ratings table. You should probably make a migration to do so, which you can do with the following command:
script/generate migration add_recommend_user script/generate migration add_recommend_rating script/generate migration add_recommend_item
Then edit the resulting migration source that it puts in db/migrate (it will be named something like 015_add_recommend_user.rb, the number at the beginning of the filename will probably be different in your instance).
The table needed by the plugin needs to be named "users" and have two columns in addition to the primary key. Also, The table named "ratings" have five columns and the table named "item" have five columns
They are:
+ users id integer name string
+ ratings id integer user_id integer item_id integer rating string ts string
+ items id integer title string
You can do this in your migration with the following code:
+user
def self.up
create_table :users do |t|
t.column :name, :string
end
end
def self.down
drop_table :users
end
+rating
def self.up
create_table :ratings do |t|
t.column :user_id, :integer
t.column :item_id, :integer
t.column :rating, :string
t.column :ts, :string
end
end
def self.down
drop_table :ratings
end
+item
def self.up
create_table :items do |t|
t.column :title, :string
end
end
def self.down
drop_table :items
end
After saving the migration run the following from the top-level directory of your rails application: $ rake migrate (rake db:migrate)
After that, you should have everything you need setup and ready to go.
It probably wouldn't hurt to run through the included unit tests quickly, but you don't have to:
$ rake test:plugins
USING THE PLUGIN
Pretty simple, really. You just need to add "acts_as_userbased_recommnedable" or "acts_as_itembased_recommendable" at the top of your ActiveRecord model, and everything should magically become available to you :)
Carefully, "acts_as_userbased_recommnedable" be included in ActiveRecord model like "User", and "acts_as_itembased_recommendable" be included in ActiveRecord model like "Item".
The Basics:
Any model that "acts_as_userbased_recommnedable" or "acts_as_itembased_recommnedable"
has the following methods available to it:
"acts_as_userbased_recommnedable"
similar_users : Find simiar users. Score that evaluatie item is simiar to each others
recommend_items : Recommend item. The recommended item is based on similarity among users.
"acts_as_itembased_recommnedable"
similar_items : Find simiar items.
Example:
class User < ActiveRecord::Base
acts_as_userbased_recommendable
cts_as_userbased_recommendable :item => "item", :rating => "ratings", :rating_value_col =>"rating" has_many :ratings
end
class Item < ActiveRecord::Base
acts_as_itembased_recommendable
cts_as_itembased_recommendable :item => "item", :rating => "ratings", :rating_value_col =>"rating" has_many :ratings
end
nital record use recommend_data.sql(Mysql version) or rake pour_sample_data
Notice! For exact recommend, It needs so many data set.
ind user at discretion for recommending item. user = User.find(:first)
=> #
ecommend item that be suitable to the user. default item number is 3 user.recommend_items
=> "The Night Listener", "Superman Returns", "Lady in the Water"]
o setting recommened item number. user.recommend_items(5)
=> "The Night Listener", "Superman Returns", "Lady in the Water", "Snakes on a Plane", "Just My Luck"]
ind similar user by similarity. user.similar_users
=> 7, 6, 5]
ind item at discretion for recommending item. item = Item.find(:first)
=> #
ind similar item by similarity item.similar_items
=> "Snakes on a Plane", "Superman Returns", "You, Me and Dupree"]
Copyright (c) 2008 Chihyung, Jung Hun Lee, released under the MIT license
Open Hub computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Open Hub cannot perform this analysis
Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Open Hub can generate statistics! It's fast and easy - try it and see!
Commercial Use
Modify
Distribute
Sub-License
Private Use
Hold Liable
Include Copyright
Include License
These details are provided for information only. No information here is legal advice and should not be used as such.
Open Hub computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Open Hub cannot perform this analysis
Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Open Hub can generate statistics! It's fast and easy - try it and see!