lib/pearson.rb
# Returns the closest entities from a given entity. The distance
# between entities is based on the Pearson correlation coefficient
#
# @param [Hash] Hash containing entity-item scores
# @param [String] Entity
# @param [Hash] Options (limit)
#
# @return [Array] Top matches
Returns the closest entities from a given entity. The distance
between entities is based on the Pearson correlation coefficient
Returns the closest entities from a given entity . The distance between entities is based on the Pearson correlation coefficient
def closest_entities(scores, entity, opts={})
      sort_desc(scores, opts) do |h, k, v|
        entity == k ? h : h.merge(k => coefficient(scores, entity, k))
      end 
    end
def closest_entities ( scores , entity , opts = { } ) sort_desc ( scores , opts ) do | h , k , v | entity == k ? h : h . merge ( k => coefficient ( scores , entity , k ) ) end end
Returns the closest entities from a given entity.
Returns the closest entities from a given entity .
None
Array
scores
entity
opts
None