recommendify_whosv 0.5.8 → 0.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c9fe29b27fad9b27ba8c563a24663113ba4b707c
4
- data.tar.gz: 0101d43d29fc778e5f53056f1575d6bb43640503
3
+ metadata.gz: fe352a805f85f1d5f1aa6606dbea21d8a9190472
4
+ data.tar.gz: 9141869e7786481b2bf77a9076fc137f97f20c1a
5
5
  SHA512:
6
- metadata.gz: 33a5019f1d981f816417c35dd49f9d61e23e88998bcb2b41c79f633a3e2ac8b4204b0160147d19eaf932a9061d784d0cdcb32973b76431d1778fdaca8f40d683
7
- data.tar.gz: dd629ee3d08a79e0afb649e09300987d9ee498571ff3d83ef4e73689d07616d6a93fcd125845d0e81bbc9938b0f3471f07c06813ae541e143af31a982bd0a64b
6
+ metadata.gz: c990edf627db9f950e3e08b3a821d5aae5ee03cc78befdfbf7b426938b8145b78e8420254ebc93ee3e498ab9fc17bb5b863c6506e28122456c8f346eb78486bb
7
+ data.tar.gz: cc5241af2b1f90130e773481ceb567bd344cc336cddf5768f3a45f4db640e182c704b0d28b915c76f08c77fe5af79ebc4803991ae4c53794b0f2bfa3a7ddce3a
@@ -0,0 +1,9 @@
1
+ require "recommendify_whosv/recommendify_whosv"
2
+ require "recommendify_whosv/sparse_matrix"
3
+ require "recommendify_whosv/cc_matrix"
4
+ require "recommendify_whosv/similarity_matrix"
5
+ require "recommendify_whosv/input_matrix"
6
+ require "recommendify_whosv/jaccard_input_matrix"
7
+ require "recommendify_whosv/cosine_input_matrix"
8
+ require "recommendify_whosv/base"
9
+ require "recommendify_whosv/neighbor"
@@ -1,4 +1,4 @@
1
- class Recommendify::Base
1
+ class RecommendifyWhosv::Base
2
2
 
3
3
  attr_reader :similarity_matrix, :input_matrices
4
4
  attr_accessor :redis_prefix_self
@@ -23,9 +23,9 @@ class Recommendify::Base
23
23
  @redis_prefix_self = opts[:redis_prefix] if opts && opts[:redis_prefix]
24
24
  @input_matrices = Hash[self.class.input_matrices.map{ |key, opts|
25
25
  opts.merge!(:key => key, :redis_prefix => redis_prefix)
26
- [ key, Recommendify::InputMatrix.create(opts) ]
26
+ [ key, RecommendifyWhosv::InputMatrix.create(opts) ]
27
27
  }]
28
- @similarity_matrix = Recommendify::SimilarityMatrix.new(
28
+ @similarity_matrix = RecommendifyWhosv::SimilarityMatrix.new(
29
29
  :max_neighbors => max_neighbors,
30
30
  :key => :similarities,
31
31
  :redis_prefix => redis_prefix
@@ -37,7 +37,7 @@ class Recommendify::Base
37
37
  end
38
38
 
39
39
  def max_neighbors
40
- self.class.max_neighbors || Recommendify::DEFAULT_MAX_NEIGHBORS
40
+ self.class.max_neighbors || RecommendifyWhosv::DEFAULT_MAX_NEIGHBORS
41
41
  end
42
42
 
43
43
  def method_missing(method, *args)
@@ -58,7 +58,7 @@ class Recommendify::Base
58
58
 
59
59
  def for(item_id)
60
60
  similarity_matrix[item_id].map do |item_id, similarity|
61
- Recommendify::Neighbor.new(
61
+ RecommendifyWhosv::Neighbor.new(
62
62
  :item_id => item_id,
63
63
  :similarity => similarity
64
64
  )
@@ -1,7 +1,7 @@
1
- module Recommendify::CCMatrix
1
+ module RecommendifyWhosv::CCMatrix
2
2
 
3
3
  def ccmatrix
4
- @ccmatrix ||= Recommendify::SparseMatrix.new(
4
+ @ccmatrix ||= RecommendifyWhosv::SparseMatrix.new(
5
5
  :redis_prefix => @opts.fetch(:redis_prefix),
6
6
  :key => [@opts.fetch(:key), :ccmatrix].join(":")
7
7
  )
@@ -26,11 +26,11 @@ module Recommendify::CCMatrix
26
26
  end
27
27
 
28
28
  def all_items
29
- Recommendify.redis.hkeys(redis_key(:items))
29
+ RecommendifyWhosv.redis.hkeys(redis_key(:items))
30
30
  end
31
31
 
32
32
  def delete_item(item_id)
33
- Recommendify.redis.hdel(redis_key(:items), item_id)
33
+ RecommendifyWhosv.redis.hdel(redis_key(:items), item_id)
34
34
  ccmatrix.send(:k_delall, item_id)
35
35
  end
36
36
 
@@ -41,11 +41,11 @@ private
41
41
  end
42
42
 
43
43
  def item_count_incr(key)
44
- Recommendify.redis.hincrby(redis_key(:items), key, 1)
44
+ RecommendifyWhosv.redis.hincrby(redis_key(:items), key, 1)
45
45
  end
46
46
 
47
47
  def item_count(key)
48
- Recommendify.redis.hget(redis_key(:items), key).to_i
48
+ RecommendifyWhosv.redis.hget(redis_key(:items), key).to_i
49
49
  end
50
50
 
51
51
  end
@@ -0,0 +1,7 @@
1
+ class RecommendifyWhosv::CosineInputMatrix < RecommendifyWhosv::InputMatrix
2
+
3
+ include RecommendifyWhosv::CCMatrix
4
+
5
+ # here be dragons ;)
6
+
7
+ end
@@ -1,8 +1,8 @@
1
- class Recommendify::InputMatrix
1
+ class RecommendifyWhosv::InputMatrix
2
2
 
3
3
  def self.create(opts)
4
- klass = "#{Recommendify.capitalize(opts[:similarity_func])}InputMatrix"
5
- Recommendify.constantize(klass.intern).new(opts)
4
+ klass = "#{RecommendifyWhosv.capitalize(opts[:similarity_func])}InputMatrix"
5
+ RecommendifyWhosv.constantize(klass.intern).new(opts)
6
6
  end
7
7
 
8
8
  def initialize(opts)
@@ -49,4 +49,4 @@ class Recommendify::InputMatrix
49
49
  raise "implemented in subclass"
50
50
  end
51
51
 
52
- end
52
+ end
@@ -1,6 +1,6 @@
1
- class Recommendify::JaccardInputMatrix < Recommendify::InputMatrix
1
+ class RecommendifyWhosv::JaccardInputMatrix < RecommendifyWhosv::InputMatrix
2
2
 
3
- include Recommendify::CCMatrix
3
+ include RecommendifyWhosv::CCMatrix
4
4
 
5
5
  def initialize(opts={})
6
6
  check_native if opts[:native]
@@ -56,7 +56,7 @@ private
56
56
  end
57
57
 
58
58
  def redis_url
59
- Recommendify.redis.client.location
59
+ RecommendifyWhosv.redis.client.location
60
60
  end
61
61
 
62
62
  end
@@ -1,4 +1,4 @@
1
- class Recommendify::Neighbor
1
+ class RecommendifyWhosv::Neighbor
2
2
 
3
3
  def initialize(data)
4
4
  @data = data
@@ -16,4 +16,4 @@ class Recommendify::Neighbor
16
16
  other.similarity <=> self.similarity
17
17
  end
18
18
 
19
- end
19
+ end
@@ -1,4 +1,4 @@
1
- module Recommendify
1
+ module RecommendifyWhosv
2
2
 
3
3
  DEFAULT_MAX_NEIGHBORS = 50
4
4
 
@@ -10,7 +10,7 @@ module Recommendify
10
10
 
11
11
  def self.redis
12
12
  return @@redis unless @@redis.nil?
13
- raise "redis not configured! - Recommendify.redis = Redis.new"
13
+ raise "redis not configured! - RecommendifyWhosv.redis = Redis.new"
14
14
  end
15
15
 
16
16
  def self.capitalize(str_or_sym)
@@ -19,7 +19,7 @@ module Recommendify
19
19
  end
20
20
 
21
21
  def self.constantize(klass)
22
- Object.module_eval("Recommendify::#{klass}", __FILE__, __LINE__)
22
+ Object.module_eval("RecommendifyWhosv::#{klass}", __FILE__, __LINE__)
23
23
  end
24
24
 
25
- end
25
+ end
@@ -1,4 +1,4 @@
1
- class Recommendify::SimilarityMatrix
1
+ class RecommendifyWhosv::SimilarityMatrix
2
2
 
3
3
  attr_reader :write_queue
4
4
 
@@ -12,7 +12,7 @@ class Recommendify::SimilarityMatrix
12
12
  end
13
13
 
14
14
  def max_neighbors
15
- @opts[:max_neighbors] || Recommendify::DEFAULT_MAX_NEIGHBORS
15
+ @opts[:max_neighbors] || RecommendifyWhosv::DEFAULT_MAX_NEIGHBORS
16
16
  end
17
17
 
18
18
  def update(item_id, neighbors)
@@ -35,7 +35,7 @@ class Recommendify::SimilarityMatrix
35
35
 
36
36
  def commit_item!(item_id)
37
37
  serialized = serialize_item(item_id)
38
- Recommendify.redis.hset(redis_key, item_id, serialized)
38
+ RecommendifyWhosv.redis.hset(redis_key, item_id, serialized)
39
39
  @write_queue.delete(item_id)
40
40
  end
41
41
 
@@ -43,7 +43,7 @@ class Recommendify::SimilarityMatrix
43
43
  # throw away this info by storing them in a hash (and re-sorting later). maybe
44
44
  # use activesupport's orderedhash?
45
45
  def retrieve_item(item_id)
46
- data = Recommendify.redis.hget(redis_key, item_id)
46
+ data = RecommendifyWhosv.redis.hget(redis_key, item_id)
47
47
  return {} if data.nil?
48
48
  Hash[data.split("|").map{ |i| (k,s=i.split(":")) && [k,s.to_f] }]
49
49
  end
@@ -1,4 +1,4 @@
1
- class Recommendify::SparseMatrix
1
+ class RecommendifyWhosv::SparseMatrix
2
2
 
3
3
  def initialize(opts={})
4
4
  @opts = opts
@@ -27,27 +27,27 @@ private
27
27
  end
28
28
 
29
29
  def k_set(key, val)
30
- Recommendify.redis.hset(redis_key, key, val)
30
+ RecommendifyWhosv.redis.hset(redis_key, key, val)
31
31
  end
32
32
 
33
33
  def k_del(key)
34
- Recommendify.redis.hdel(redis_key, key)
34
+ RecommendifyWhosv.redis.hdel(redis_key, key)
35
35
  end
36
36
 
37
37
  def k_get(key)
38
- Recommendify.redis.hget(redis_key, key).to_f
38
+ RecommendifyWhosv.redis.hget(redis_key, key).to_f
39
39
  end
40
40
 
41
41
  def k_incr(key)
42
- Recommendify.redis.hincrby(redis_key, key, 1)
42
+ RecommendifyWhosv.redis.hincrby(redis_key, key, 1)
43
43
  end
44
44
 
45
45
  # OPTIMIZE: use scripting/lua in redis 2.6
46
46
  def k_delall(*keys)
47
- Recommendify.redis.hkeys(redis_key).each do |iikey|
47
+ RecommendifyWhosv.redis.hkeys(redis_key).each do |iikey|
48
48
  next unless (iikey.split(":") & keys).size > 0
49
- Recommendify.redis.hdel(redis_key, iikey)
49
+ RecommendifyWhosv.redis.hdel(redis_key, iikey)
50
50
  end
51
51
  end
52
52
 
53
- end
53
+ end
@@ -3,12 +3,12 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "recommendify_whosv"
6
- s.version = "0.5.8"
6
+ s.version = "0.6.8"
7
7
  s.date = Date.today.to_s
8
8
  s.platform = Gem::Platform::RUBY
9
- s.authors = ["Paul Asmuth"]
10
- s.email = ["paul@paulasmuth.com"]
11
- s.homepage = "http://github.com/paulasmuth/recommendify"
9
+ s.authors = ["Halsey"]
10
+ s.email = ["halsey@whosv.com"]
11
+ s.homepage = "https://github.com/three-letter/recommendify.git"
12
12
  s.summary = %q{ruby/redis based recommendation engine (collaborative filtering)}
13
13
  s.description = %q{Recommendify is a distributed, incremental item-based recommendation engine for binary input ratings. It's based on ruby and redis and uses an approach called "Collaborative Filtering"}
14
14
  s.licenses = ["MIT"]
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recommendify_whosv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.8
4
+ version: 0.6.8
5
5
  platform: ruby
6
6
  authors:
7
- - Paul Asmuth
7
+ - Halsey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
@@ -42,7 +42,7 @@ description: Recommendify is a distributed, incremental item-based recommendatio
42
42
  engine for binary input ratings. It's based on ruby and redis and uses an approach
43
43
  called "Collaborative Filtering"
44
44
  email:
45
- - paul@paulasmuth.com
45
+ - halsey@whosv.com
46
46
  executables: []
47
47
  extensions:
48
48
  - ext/extconf.rb
@@ -63,17 +63,17 @@ files:
63
63
  - ext/recommendify.c
64
64
  - ext/sort.c
65
65
  - ext/version.h
66
- - lib/recommendify.rb
67
- - lib/recommendify/base.rb
68
- - lib/recommendify/cc_matrix.rb
69
- - lib/recommendify/cosine_input_matrix.rb
70
- - lib/recommendify/input_matrix.rb
71
- - lib/recommendify/jaccard_input_matrix.rb
72
- - lib/recommendify/neighbor.rb
73
- - lib/recommendify/recommendify.rb
74
- - lib/recommendify/similarity_matrix.rb
75
- - lib/recommendify/sparse_matrix.rb
76
- - recommendify.gemspec
66
+ - lib/recommendify_whosv.rb
67
+ - lib/recommendify_whosv/base.rb
68
+ - lib/recommendify_whosv/cc_matrix.rb
69
+ - lib/recommendify_whosv/cosine_input_matrix.rb
70
+ - lib/recommendify_whosv/input_matrix.rb
71
+ - lib/recommendify_whosv/jaccard_input_matrix.rb
72
+ - lib/recommendify_whosv/neighbor.rb
73
+ - lib/recommendify_whosv/recommendify_whosv.rb
74
+ - lib/recommendify_whosv/similarity_matrix.rb
75
+ - lib/recommendify_whosv/sparse_matrix.rb
76
+ - recommendify_whosv.gemspec
77
77
  - spec/base_spec.rb
78
78
  - spec/cc_matrix_shared.rb
79
79
  - spec/cosine_input_matrix_spec.rb
@@ -84,7 +84,7 @@ files:
84
84
  - spec/similarity_matrix_spec.rb
85
85
  - spec/sparse_matrix_spec.rb
86
86
  - spec/spec_helper.rb
87
- homepage: http://github.com/paulasmuth/recommendify
87
+ homepage: https://github.com/three-letter/recommendify.git
88
88
  licenses:
89
89
  - MIT
90
90
  metadata: {}
data/lib/recommendify.rb DELETED
@@ -1,9 +0,0 @@
1
- require "recommendify/recommendify"
2
- require "recommendify/sparse_matrix"
3
- require "recommendify/cc_matrix"
4
- require "recommendify/similarity_matrix"
5
- require "recommendify/input_matrix"
6
- require "recommendify/jaccard_input_matrix"
7
- require "recommendify/cosine_input_matrix"
8
- require "recommendify/base"
9
- require "recommendify/neighbor"
@@ -1,7 +0,0 @@
1
- class Recommendify::CosineInputMatrix < Recommendify::InputMatrix
2
-
3
- include Recommendify::CCMatrix
4
-
5
- # here be dragons ;)
6
-
7
- end