disco 0.3.1 → 0.3.2
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +2 -4
- data/lib/disco/recommender.rb +5 -0
- data/lib/disco/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 645a5f169c78e36ee6394a71ba61ac611cb333176adff84812c8a25549e2ea28
|
4
|
+
data.tar.gz: 68caa44554bff09a39a68522ad5c8008164840186c08e0fdbad8f9e465855c89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 104a016c693c0256cae13d4545df4112538a1f7a66c8790c38a1b434f144c8d2fb173d2428bbc9168e2581e0e9399d761083500fca69919c07f86b2f1e6582ee
|
7
|
+
data.tar.gz: 3d06f45fdcf63ea26fa48c18ec5304d22f3306da5bb3fa0a2bcd107455002dbfda56e0df22f61270c12374cb693ad6da2d747bd363c0ec001048f23690b3efe1
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -187,9 +187,7 @@ json = recommender.to_json
|
|
187
187
|
File.write("recommender.json", json)
|
188
188
|
```
|
189
189
|
|
190
|
-
|
191
|
-
|
192
|
-
The serialized recommender includes user activity from the training data (to avoid recommending previously rated items), so be sure to protect it.
|
190
|
+
The serialized recommender includes user activity from the training data (to avoid recommending previously rated items), so be sure to protect it. You can save it to a file, database, or any other storage system, or use a tool like [Trove](https://github.com/ankane/trove). Also, user and item IDs should be integers or strings for this.
|
193
191
|
|
194
192
|
Load a recommender
|
195
193
|
|
@@ -225,7 +223,7 @@ recommender.fit(data, validation_set: validation_set)
|
|
225
223
|
|
226
224
|
## Cold Start
|
227
225
|
|
228
|
-
Collaborative filtering suffers from the [cold start problem](https://
|
226
|
+
Collaborative filtering suffers from the [cold start problem](https://en.wikipedia.org/wiki/Cold_start_(recommender_systems)). It’s unable to make good recommendations without data on a user or item, which is problematic for new users and items.
|
229
227
|
|
230
228
|
```ruby
|
231
229
|
recommender.user_recs(new_user_id) # returns empty array
|
data/lib/disco/recommender.rb
CHANGED
@@ -36,6 +36,8 @@ module Disco
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
+
@user_map = {}
|
40
|
+
@item_map = {}
|
39
41
|
@rated = Hash.new { |hash, key| hash[key] = {} }
|
40
42
|
input = []
|
41
43
|
train_set.each do |v|
|
@@ -56,6 +58,9 @@ module Disco
|
|
56
58
|
# TODO improve performance
|
57
59
|
unless @implicit
|
58
60
|
@min_rating, @max_rating = train_set.minmax_by { |o| o[:rating] }.map { |o| o[:rating] }
|
61
|
+
else
|
62
|
+
@min_rating = nil
|
63
|
+
@max_rating = nil
|
59
64
|
end
|
60
65
|
|
61
66
|
if @top_items
|
data/lib/disco/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: disco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: libmf
|