recommendable 2.1.0.1 → 2.1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 91c45d80ed7ced8b477f8753ad6611b716e0395a
4
- data.tar.gz: 7103dd3d7eb386ce8e019b45caade3139b7c8ea9
3
+ metadata.gz: c546b37739a601150d95da118ef2e6a329a61beb
4
+ data.tar.gz: ae11ffa0ee1362b3f117fdfece1039eaecb57f1a
5
5
  SHA512:
6
- metadata.gz: eca1215ebbdc0944e24a168ea6ee5a069300dbe7a7cf06051461cc4226eebcf4686ff321aacd07a932a96b08797d65c57084f52421b55ba292d4015095972c97
7
- data.tar.gz: 50e043455fb3f7780727a54b7292e4c78045c3691c091ebb79af2204dc10df1e919a2255524b05210fed90186df812fe68cb20e2411cb5998e2de36f518436b5
6
+ metadata.gz: 52e983ca6a66f6c5a141b4f651b3043d25e6a74e5c832e8bcf9638e5c774461f50d87b5ab2c1e44a0ddcfa0e817911d550f0d526aac3f9a16733a78a4ed63631
7
+ data.tar.gz: 10045b2b278f86be82fb47ba8237f7556a83d444dd08154f4239b256bcc35aaf63d8689552f8169b31461bf42b0966f6bcd568f9b32c85bf03f896f045e56481
@@ -12,6 +12,9 @@ module Recommendable
12
12
  # @return [Float] the numeric similarity between this user and the passed user
13
13
  # @note Similarity values are asymmetrical. `Calculations.similarity_between(user_id, other_user_id)` will not necessarily equal `Calculations.similarity_between(other_user_id, user_id)`
14
14
  def similarity_between(user_id, other_user_id)
15
+ user_id = user_id.to_s
16
+ other_user_id = other_user_id.to_s
17
+
15
18
  similarity = liked_count = disliked_count = 0
16
19
  in_common = Recommendable.config.ratable_classes.each do |klass|
17
20
  liked_set = Recommendable::Helpers::RedisKeyMapper.liked_set_for(klass, user_id)
@@ -82,6 +85,8 @@ module Recommendable
82
85
  #
83
86
  # @private
84
87
  def update_recommendations_for(user_id)
88
+ user_id = user_id.to_s
89
+
85
90
  nearest_neighbors = Recommendable.config.nearest_neighbors || Recommendable.config.user_class.count
86
91
  Recommendable.config.ratable_classes.each do |klass|
87
92
  rated_sets = [
@@ -138,6 +143,9 @@ module Recommendable
138
143
  # @param [Fixnum, String] item_id the item's ID
139
144
  # @return [Float] the probability that the user will like the item
140
145
  def predict_for(user_id, klass, item_id)
146
+ user_id = user_id.to_s
147
+ item_id = item_id.to_s
148
+
141
149
  similarity_set = Recommendable::Helpers::RedisKeyMapper.similarity_set_for(user_id)
142
150
  liked_by_set = Recommendable::Helpers::RedisKeyMapper.liked_by_set_for(klass, item_id)
143
151
  disliked_by_set = Recommendable::Helpers::RedisKeyMapper.disliked_by_set_for(klass, item_id)
@@ -77,13 +77,13 @@ module Recommendable
77
77
  end
78
78
  elsif method.to_s =~ /\A((?:dis)?liked|hidden|bookmarked)_(.+)_ids\z/
79
79
  begin
80
- send("#{$1}_ids_for", $2.classify.constantize)
80
+ send("#{$1}_ids_for", $2.classify.constantize, *args)
81
81
  rescue NameError
82
82
  super
83
83
  end
84
84
  elsif method.to_s =~ /\A((?:dis)?liked|hidden|bookmarked|recommended)_(.+)\z/
85
85
  begin
86
- send("#{$1}_for", $2.classify.constantize)
86
+ send("#{$1}_for", $2.classify.constantize, *args)
87
87
  rescue NameError
88
88
  super
89
89
  end
@@ -2,7 +2,7 @@ module Recommendable
2
2
  MAJOR = 2
3
3
  MINOR = 1
4
4
  PATCH = 0
5
- PRE = 1
5
+ PRE = 2
6
6
 
7
7
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join '.'
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recommendable
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.1
4
+ version: 2.1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Celis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-20 00:00:00.000000000 Z
11
+ date: 2013-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport