svmkit 0.3.0 → 0.3.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: 855d3ac2dcfbfde9eb82a4661f17cebb75b4b7c57ba37ee26a8aa03d0f1ccab8
4
- data.tar.gz: 13ec3e84fd6f4fcd973d164b3d6f395c024e42095eae63819bea6ef4179697d9
3
+ metadata.gz: 558b550a373cb5cbe7c295dc589c57b6b37a697b8309fa5497e5b0da6fd83336
4
+ data.tar.gz: ab8241d5e35446f1e7342a08fcb915bed0542a65fcaf4837c358d19699b791e9
5
5
  SHA512:
6
- metadata.gz: be8b4e4528e70ab99c8b9f1ad0d93d717b0359d30ca9b142b4d5cb44b6b3875cc9d97f199021ab48ab3b9cc1e635f37c14dbb15efe81b55de673d83b65cc10ab
7
- data.tar.gz: 9c8ae85dc3ca8dd7fe6bd15bd4b3eb46b775b32923691a12f9621032bcbffea7a3405404a9b8924f68a344d771cac56f439e6e2c024f68deacd00d7358c3c4f4
6
+ metadata.gz: a4739788d141bae29fdf1baba602ba76c51299cd8f8536e1a919084d94601b5ddeb02f9128b289965c4c821a925f063da0c2eec9b360dd5190ef9b9c9f2daae5
7
+ data.tar.gz: 1fdee6fec50ee3d995639d8c78f6e7c259456e1c0b1a916c40ec1e16ff578ecb63b4f7029029c129e6723c69bf19161e9e48589bd9954c8e8ab1ea90b777a870
data/HISTORY.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.3.1
2
+ - Fix bug on decision function calculation of FactorizationMachineClassifier.
3
+ - Fix bug on weight updating process of KernelSVC.
4
+
1
5
  # 0.3.0
2
6
  - Add class for Support Vector Regression.
3
7
  - Add class for K-Nearest Neighbor Regression.
@@ -183,11 +183,11 @@ module SVMKit
183
183
  rand_ids = [*0...n_training_samples].shuffle(random: @rng) if rand_ids.empty?
184
184
  target_id = rand_ids.shift
185
185
  # update the weight vector
186
- func = (weight_vec * bin_y[target_id]).dot(x[target_id, true].transpose).to_f
186
+ func = (weight_vec * bin_y).dot(x[target_id, true].transpose).to_f
187
187
  func *= bin_y[target_id] / (@params[:reg_param] * (t + 1))
188
188
  weight_vec[target_id] += 1.0 if func < 1.0
189
189
  end
190
- weight_vec * Numo::DFloat[*bin_y]
190
+ weight_vec * bin_y
191
191
  end
192
192
  end
193
193
  end
@@ -127,7 +127,7 @@ module SVMKit
127
127
  SVMKit::Validation.check_sample_array(x)
128
128
  linear_term = @bias_term + x.dot(@weight_vec.transpose)
129
129
  factor_term = if @classes.size <= 2
130
- 0.5 * (@factor_mat.dot(x.transpose)**2 - (@factor_mat**2).dot(x.transpose**2)).sum
130
+ 0.5 * (@factor_mat.dot(x.transpose)**2 - (@factor_mat**2).dot(x.transpose**2)).sum(0)
131
131
  else
132
132
  0.5 * (@factor_mat.dot(x.transpose)**2 - (@factor_mat**2).dot(x.transpose**2)).sum(1).transpose
133
133
  end
@@ -217,7 +217,7 @@ module SVMKit
217
217
  end
218
218
 
219
219
  def bin_decision_function(x, factor, weight, bias)
220
- bias + x.dot(weight) + 0.5 * (factor.dot(x.transpose)**2 - (factor**2).dot(x.transpose**2)).sum
220
+ bias + x.dot(weight) + 0.5 * (factor.dot(x.transpose)**2 - (factor**2).dot(x.transpose**2)).sum(0)
221
221
  end
222
222
 
223
223
  def hinge_loss_gradient(x, y, factor, weight, bias)
@@ -3,5 +3,5 @@
3
3
  # SVMKit is a machine learning library in Ruby.
4
4
  module SVMKit
5
5
  # @!visibility private
6
- VERSION = '0.3.0'.freeze
6
+ VERSION = '0.3.1'.freeze
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svmkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - yoshoku
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-13 00:00:00.000000000 Z
11
+ date: 2018-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: numo-narray