collaborative_filtering 0.5.0 → 0.6.0

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: d07a5619548e3e8ae7cae53f3a2e0ca22ccd7a47
4
- data.tar.gz: e000e343323ac5ef43b1d700d10a4edea0216aca
3
+ metadata.gz: 9b794ed0cd16798e0bd2668faaed2f8ab9586e3e
4
+ data.tar.gz: 3438b8c17792d3ca629f71f8be999a941b594d32
5
5
  SHA512:
6
- metadata.gz: c0ccbcdfa040ba66a47cfbd8896873114588998fbd0cdc45025c142c82df90b590f9eef014283edd719941b9ed29ebfbee56f2bc91afea9c2c2096a5aab0002c
7
- data.tar.gz: c1478a1de189160a79a43ccd1f91b7032f6fb4c4ea827cb9e5ccbba56a903f8b475ad7a77d753a4b7398ea727ef275131d640b33db990e3de360e01d9675d7f0
6
+ metadata.gz: d96b693800974c9b2b93fe5ab6a6d18f2b0051c978204331b6f790ab577678f85560087477d732ae3352251b57541a894d6e30c2ce4b37d1431ab176424f42e8
7
+ data.tar.gz: 55ce7e3560cd05331ea92b0e83449049df5edcff8645130c759d060a101942e6fbff2199867b572a0f18b5d21190bf5a21815ccfa3d088ca243300a768cee738
data/README.md CHANGED
@@ -25,6 +25,44 @@ Or install it yourself as:
25
25
 
26
26
  ## Usage
27
27
 
28
+ ```ruby
29
+ require 'collaborative_filtering'
30
+
31
+ CollaborativeFiltering.all_sample
32
+ ```
33
+
34
+ ```
35
+ //////////////////////////////////////////////////////////////
36
+ // this source exists lib/collaborative_filtering/sample.rb //
37
+ //////////////////////////////////////////////////////////////
38
+
39
+ {
40
+ "Yamada"=>{"Curry"=>2.5, "Ramen"=>3.5, "Fried rice"=>3.0, "Sushi"=>3.5, "Beef bowl"=>2.5, "Wheat noodle"=>3.0},
41
+ "Tanaka"=>{"Curry"=>3.0, "Ramen"=>3.5, "Fried rice"=>1.5, "Sushi"=>5.0, "Wheat noodle"=>3.0, "Beef bowl"=>3.5},
42
+ "Sato"=>{"Curry"=>2.5, "Ramen"=>3.0, "Sushi"=>3.5, "Wheat noodle"=>4.0},
43
+ "Nakamura"=>{"Ramen"=>3.5, "Fried rice"=>3.0, "Wheat noodle"=>4.5, "Sushi"=>4.0, "Beef bowl"=>2.5},
44
+ "Kawamura"=>{"Curry"=>3.0, "Ramen"=>4.0, "Fried rice"=>2.0, "Sushi"=>3.0, "Wheat noodle"=>3.0, "Beef bowl"=>2.0},
45
+ "Suzuki"=>{"Curry"=>3.0, "Ramen"=>4.0, "Wheat noodle"=>3.0, "Sushi"=>5.0, "Beef bowl"=>3.5},
46
+ "Shimobayashi"=>{"Ramen"=>4.5, "Beef bowl"=>1.0, "Sushi"=>4.0}
47
+ }
48
+
49
+ write like this -> CollaborativeFiltering.sim_distance(SAMPLE, 'Yamada', 'Tanaka')
50
+ 0.14814814814814814
51
+
52
+ write like this -> CollaborativeFiltering.sim_pearson(SAMPLE, 'Yamada', 'Tanaka')
53
+ 0.39605901719066977
54
+
55
+ write like this -> CollaborativeFiltering.top_matches(SAMPLE, 'Shimobayashi')
56
+ [[0.9912407071619299, "Yamada"], [0.9244734516419049, "Kawamura"], [0.8934051474415647, "Nakamura"], [0.66284898035987, "Suzuki"], [0.38124642583151164, "Tanaka"]]
57
+
58
+ write like this -> CollaborativeFiltering.get_recommendations(SAMPLE, 'Shimobayashi')
59
+ [[3.3477895267131017, "Wheat noodle"], [2.8325499182641614, "Curry"], [2.530980703765565, "Fried rice"]]
60
+
61
+ write like this -> menu = CollaborativeFiltering.transform_prefs(SAMPLE)
62
+ write like this -> CollaborativeFiltering.top_matches(menu, 'Sushi')
63
+ [[0.6579516949597695, "Beef bowl"], [0.4879500364742689, "Curry"], [0.11180339887498941, "Ramen"], [-0.1798471947990544, "Wheat noodle"], [-0.42289003161103106, "Fried rice"]]
64
+ ```
65
+
28
66
  ## Development
29
67
 
30
68
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -1,3 +1,3 @@
1
1
  module CollaborativeFiltering
2
- VERSION = '0.5.0'
2
+ VERSION = '0.6.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: collaborative_filtering
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shoya TANAKA