libmf 0.1.1 → 0.1.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
  SHA256:
3
- metadata.gz: 2f46be88d7d3f59b4c77ad15c4843a4f88745ec4433a09193ce28a7cc77c1b38
4
- data.tar.gz: 7b39d8a0d9c9495fb91c6424903fee5f694672493c031f9107f8db49571b384d
3
+ metadata.gz: 907cba459d6d4af0607aa2662b0f32b5afc30a1940cbf6c4e7712553cb95709c
4
+ data.tar.gz: 16e84358005ebb5432a2765c00dd79fe26f9822cbdfcb0570d829099c11e5470
5
5
  SHA512:
6
- metadata.gz: 0b95f27bc77e5a6f2c8352c960d5005c5ac0011e7eaff80f63608294536af074a6fbdefbc0932ae1a13769f8264ad044a419fade2377c56a93aa8ac885bb4662
7
- data.tar.gz: ed73f96ce4cd0c1bd105ad5b7b6c0f85a9f14949e4cc48f107714d791b0ec20e64398697778da87c41003cd742fe13ed789aec29296aff7518c7b01a4bc5052b
6
+ metadata.gz: 56e8dd57eb146cf81ffd11c193565e632f623d0ade5c2650344e19951502bd492becf6268066da6c630936e5bb08e3ee068d9ecb7f942457955c88b1faf9e5eb
7
+ data.tar.gz: 2764dab3e8d5d3044bf78482988addeb40c026b592cb57ccec3984f70244eeaf77a0a8a4e597a8607d9cf41c74e69ab47391f1003ba163a45b84b010821a76c5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.1.2
2
+
3
+ - Fixed bug in `p_factors` and `q_factors` methods
4
+
1
5
  ## 0.1.1
2
6
 
3
7
  - Fixed errors on Linux and Windows
data/lib/libmf.bundle ADDED
Binary file
data/lib/libmf/model.rb CHANGED
@@ -52,11 +52,11 @@ module Libmf
52
52
  end
53
53
 
54
54
  def p_factors
55
- reshape(model[:p].read_array_of_float(factors * rows), [rows, factors])
55
+ reshape(model[:p].read_array_of_float(factors * rows), factors)
56
56
  end
57
57
 
58
58
  def q_factors
59
- reshape(model[:q].read_array_of_float(factors * columns), [columns, factors])
59
+ reshape(model[:q].read_array_of_float(factors * columns), factors)
60
60
  end
61
61
 
62
62
  private
@@ -100,13 +100,8 @@ module Libmf
100
100
  prob
101
101
  end
102
102
 
103
- def reshape(arr, dims)
104
- rows = dims.first
105
- new_arr = rows.times.map { [] }
106
- arr.each_with_index do |v, i|
107
- new_arr[i % rows] << v
108
- end
109
- new_arr
103
+ def reshape(arr, factors)
104
+ arr.each_slice(factors).to_a
110
105
  end
111
106
  end
112
107
  end
data/lib/libmf/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Libmf
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libmf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.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: 2019-11-06 00:00:00.000000000 Z
11
+ date: 2019-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -91,6 +91,7 @@ files:
91
91
  - LICENSE.txt
92
92
  - README.md
93
93
  - ext/libmf/extconf.rb
94
+ - lib/libmf.bundle
94
95
  - lib/libmf.rb
95
96
  - lib/libmf/ffi.rb
96
97
  - lib/libmf/model.rb