Class: CollaborativeFilter::ContentBooster
- Inherits:
-
Object
- Object
- CollaborativeFilter::ContentBooster
- Defined in:
- lib/collaborative_filter/content_booster.rb
Defined Under Namespace
Classes: Gene
Instance Attribute Summary collapse
-
#booster(booster_class = nil) ⇒ Object
readonly
Returns the value of attribute booster.
-
#genes ⇒ Object
readonly
Returns the value of attribute genes.
Instance Method Summary collapse
- #crossover(point = nil) ⇒ Object
- #factor(input = nil) ⇒ Object
- #gene(name, &block) ⇒ Object
-
#initialize ⇒ ContentBooster
constructor
A new instance of ContentBooster.
- #run(recommendations, datasets) ⇒ Object
- #threshold(input = nil) ⇒ Object
Constructor Details
#initialize ⇒ ContentBooster
Returns a new instance of ContentBooster.
6 7 8 |
# File 'lib/collaborative_filter/content_booster.rb', line 6 def initialize @genes = {} end |
Instance Attribute Details
#booster(booster_class = nil) ⇒ Object (readonly)
Returns the value of attribute booster.
4 5 6 |
# File 'lib/collaborative_filter/content_booster.rb', line 4 def booster @booster end |
#genes ⇒ Object (readonly)
Returns the value of attribute genes.
3 4 5 |
# File 'lib/collaborative_filter/content_booster.rb', line 3 def genes @genes end |
Instance Method Details
#crossover(point = nil) ⇒ Object
21 22 23 24 |
# File 'lib/collaborative_filter/content_booster.rb', line 21 def crossover(point=nil) return @crossover unless point @crossover = point end |
#factor(input = nil) ⇒ Object
31 32 33 34 |
# File 'lib/collaborative_filter/content_booster.rb', line 31 def factor(input=nil) return @factor unless input @factor = input end |
#gene(name, &block) ⇒ Object
15 16 17 18 19 |
# File 'lib/collaborative_filter/content_booster.rb', line 15 def gene(name, &block) gene = Gene.new gene.finder = block @genes[name] = gene end |
#run(recommendations, datasets) ⇒ Object
37 38 39 40 |
# File 'lib/collaborative_filter/content_booster.rb', line 37 def run(recommendations,datasets) = { :crossover => @crossover, :threshold => @threshold, :factor => @factor } @booster.new.run(recommendations,datasets,@genes,) end |
#threshold(input = nil) ⇒ Object
26 27 28 29 |
# File 'lib/collaborative_filter/content_booster.rb', line 26 def threshold(input=nil) return @threshold unless input @threshold = input end |