disco 0.5.0 → 0.5.1

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
  SHA256:
3
- metadata.gz: ffa944ca55d7da5a4dc4cced181d013a9fdc0f1fbb76af6003ba3049bb299682
4
- data.tar.gz: 64f389a3a93173b3d24cad85e5072b4d3f8965a729387a5845ed9c86098a9496
3
+ metadata.gz: b1d7b56a9c40088874bbd79ff7fa5bf8783a4406a9e5dadf1dddb04303ca7fee
4
+ data.tar.gz: 0d843da83fc246b5da2aa097eba3534d729b51d9b03c368226b884fe33e61795
5
5
  SHA512:
6
- metadata.gz: f167237c7553d5a506467844d6acf860e81efca11da4e8facb8988cc994fbe70a52b38ff87b0d1157bcf9312b172c8794b49e6e8607748f77b129bcac26742d2
7
- data.tar.gz: f5feab5c5d88dac8cc5a01cbab437110d0fe41c4fa98283464174d253996d8c8efa9dc92724f30bbae334c7fe2c7cb932b2b6335bd37f44aa645ef33fa7ec7ea
6
+ metadata.gz: 49341b30e2ffa7348c19af2c0073f8f9e15afe3dcd856922fb5ae3fd3cd6e5ab555731c38bf3678f5f4efb064ecfce994d24b6238aa93fbc62e4621d7de036ab
7
+ data.tar.gz: 9bb387230927cf55e94c3614c4a68881031206c9ee2dee2d48c06f6053134cdff0af4c4d24eba825acf3429394556368378bd51860f4dfcddf0dd1742309794f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.5.1 (2024-12-29)
2
+
3
+ - Removed dependency on `base64` gem for serialization
4
+
1
5
  ## 0.5.0 (2024-10-22)
2
6
 
3
7
  - Changed dataset directory to match XDG Base Directory Specification
@@ -261,7 +261,6 @@ module Disco
261
261
  end
262
262
 
263
263
  def to_json
264
- require "base64"
265
264
  require "json"
266
265
 
267
266
  obj = {
@@ -270,8 +269,8 @@ module Disco
270
269
  item_ids: @item_map.keys,
271
270
  rated: @user_map.map { |_, u| (@rated[u] || {}).keys },
272
271
  global_mean: @global_mean,
273
- user_factors: Base64.strict_encode64(@user_factors.to_binary),
274
- item_factors: Base64.strict_encode64(@item_factors.to_binary),
272
+ user_factors: [@user_factors.to_binary].pack("m0"),
273
+ item_factors: [@item_factors.to_binary].pack("m0"),
275
274
  factors: @factors,
276
275
  epochs: @epochs,
277
276
  verbose: @verbose
@@ -432,16 +431,14 @@ module Disco
432
431
  end
433
432
 
434
433
  def json_load(obj)
435
- require "base64"
436
-
437
434
  @implicit = obj["implicit"]
438
435
  @user_map = obj["user_ids"].map.with_index.to_h
439
436
  @item_map = obj["item_ids"].map.with_index.to_h
440
437
  @rated = obj["rated"].map.with_index.to_h { |r, i| [i, r.to_h { |v| [v, true] }] }
441
438
  @global_mean = obj["global_mean"].to_f
442
439
  @factors = obj["factors"].to_i
443
- @user_factors = Numo::SFloat.from_binary(Base64.strict_decode64(obj["user_factors"]), [@user_map.size, @factors])
444
- @item_factors = Numo::SFloat.from_binary(Base64.strict_decode64(obj["item_factors"]), [@item_map.size, @factors])
440
+ @user_factors = Numo::SFloat.from_binary(obj["user_factors"].unpack1("m0"), [@user_map.size, @factors])
441
+ @item_factors = Numo::SFloat.from_binary(obj["item_factors"].unpack1("m0"), [@item_map.size, @factors])
445
442
  @epochs = obj["epochs"].to_i
446
443
  @verbose = obj["verbose"]
447
444
 
data/lib/disco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Disco
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: disco
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-10-23 00:00:00.000000000 Z
10
+ date: 2024-12-30 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: libmf
@@ -38,7 +37,6 @@ dependencies:
38
37
  - - ">="
39
38
  - !ruby/object:Gem::Version
40
39
  version: 0.9.2
41
- description:
42
40
  email: andrew@ankane.org
43
41
  executables: []
44
42
  extensions: []
@@ -61,7 +59,6 @@ homepage: https://github.com/ankane/disco
61
59
  licenses:
62
60
  - MIT
63
61
  metadata: {}
64
- post_install_message:
65
62
  rdoc_options: []
66
63
  require_paths:
67
64
  - lib
@@ -76,8 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
73
  - !ruby/object:Gem::Version
77
74
  version: '0'
78
75
  requirements: []
79
- rubygems_version: 3.5.16
80
- signing_key:
76
+ rubygems_version: 3.6.2
81
77
  specification_version: 4
82
78
  summary: Recommendations for Ruby and Rails using collaborative filtering
83
79
  test_files: []