Class: CollaborativeFilter
- Inherits:
-
Object
- Object
- CollaborativeFilter
- Defined in:
- lib/correlators/simple_svd.rb,
lib/collaborative_filter.rb,
lib/boosters/simple_booster.rb,
lib/collaborative_filter/config.rb,
lib/collaborative_filter/output.rb,
lib/collaborative_filter/data_set.rb,
lib/recommenders/simplest_recommender.rb,
lib/collaborative_filter/content_booster.rb,
lib/collaborative_filter/output/yaml_adapter.rb,
lib/collaborative_filter/output/mysql_adapter.rb
Overview
SimpleBooster - a content booster for CollaborativeFiltration
The purpose of a content booster is to improve the purely collaborative output from a recommender. Collaborative filtration relies on the idea that if you have similar ratings/purchases as someone else in the past, you are likely to continue to in the future.
The fallacy of this is obvious when you consider that Bob may really enjoy Superhero comics and Horror comics. Joe really enjoys Superhero comics and Humor comics. Depending on how many things they rate and other factors, Joe and Bob may still have a high correlation. However, Bob’s love of Horror comics may infiltrate Joe’s ratings despite the fact that Joe really dislikes them.
So, a content booster allows us to nudge the value of your recommendations up or down. One strategy for using a content booster is to set the threshold on your recommender low (say… 2.5 or 3), but the threshold on the content booster high.
Defined Under Namespace
Classes: Config, ContentBooster, DataSet, Output, SimpleBooster, SimpleSvd, SimplestRecommender
Class Method Summary collapse
Class Method Details
.config ⇒ Object
3 4 5 |
# File 'lib/collaborative_filter/config.rb', line 3 def self.config @@config ||= Config.new end |
.filter(options = {}) {|config| ... } ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/collaborative_filter.rb', line 13 def self.filter(={}) @@logger = [:logger] log "Starting configuration: #{Time.now}" raise '#setup must be sent a block' unless block_given? yield config log "Starting correlations: #{Time.now}" config.datasets.each do |name,ds| log " Correlating '#{name}': #{Time.now}" ds.run end log "Starting recommender: #{Time.now}" recommendations = config.recommender.new.run(config.datasets, config.) log "Starting booster: #{Time.now}" recommendations = config.content_booster.run(recommendations, config.datasets) log "Output: #{Time.now}" Output.store config.output, recommendations log "Done: #{Time.now}" end |
.log(msg) ⇒ Object
38 39 40 |
# File 'lib/collaborative_filter.rb', line 38 def self.log(msg) @@logger.info(msg) if @@logger end |