Class: Recommendify::JaccardInputMatrix

Inherits:
InputMatrix show all
Includes:
CCMatrix
Defined in:
lib/recommendify/jaccard_input_matrix.rb

Instance Method Summary collapse

Methods included from CCMatrix

#add_set, #add_single, #all_items, #ccmatrix, #delete_item

Methods inherited from InputMatrix

#add_set, #add_single, #all_items, create, #delete_item, #redis_key, #weight

Constructor Details

#initialize(opts = {}) ⇒ JaccardInputMatrix

Returns a new instance of JaccardInputMatrix.



5
6
7
8
# File 'lib/recommendify/jaccard_input_matrix.rb', line 5

def initialize(opts={})
  check_native if opts[:native]
  super(opts)
end

Instance Method Details

#similarities_for(item1) ⇒ Object



14
15
16
17
# File 'lib/recommendify/jaccard_input_matrix.rb', line 14

def similarities_for(item1)
  return run_native(item1) if @opts[:native]
  calculate_similarities(item1)
end

#similarity(item1, item2) ⇒ Object



10
11
12
# File 'lib/recommendify/jaccard_input_matrix.rb', line 10

def similarity(item1, item2)
  calculate_jaccard_cached(item1, item2)
end