Class: Likes::Set
- Inherits:
-
Object
- Object
- Likes::Set
- Defined in:
- lib/likes/set.rb
Overview
Job: Understands patterns in people likings
Constant Summary collapse
- DEFAULT_ENGINE =
Default engine - simplest one
Engines::BestIntersectionSize
Instance Method Summary collapse
-
#initialize(likes, engine = DEFAULT_ENGINE) ⇒ Set
constructor
Creates new instance of Set.
-
#recommendations_for(person) ⇒ Array<Item>
Provides list of recommendations for person based on this likeset.
Constructor Details
#initialize(likes, engine = DEFAULT_ENGINE) ⇒ Set
Creates new instance of Set
15 16 17 18 19 20 |
# File 'lib/likes/set.rb', line 15 def initialize(likes, engine=DEFAULT_ENGINE) @likes = likes @engine = engine build_likes_of build_liked end |
Instance Method Details
#recommendations_for(person) ⇒ Array<Item>
Provides list of recommendations for person based on this likeset
Should handle amount of distinct people <= 10**6 and amount of distinct items <= 10**6, but likeset length is <= 10**7, ie it is advised to use only recent likes (couple of weeks or month)
32 33 34 |
# File 'lib/likes/set.rb', line 32 def recommendations_for(person) engine.new(person, likes_of, liked).solve end |