svmkit 0.3.0 → 0.3.1
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 558b550a373cb5cbe7c295dc589c57b6b37a697b8309fa5497e5b0da6fd83336
|
4
|
+
data.tar.gz: ab8241d5e35446f1e7342a08fcb915bed0542a65fcaf4837c358d19699b791e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4739788d141bae29fdf1baba602ba76c51299cd8f8536e1a919084d94601b5ddeb02f9128b289965c4c821a925f063da0c2eec9b360dd5190ef9b9c9f2daae5
|
7
|
+
data.tar.gz: 1fdee6fec50ee3d995639d8c78f6e7c259456e1c0b1a916c40ec1e16ff578ecb63b4f7029029c129e6723c69bf19161e9e48589bd9954c8e8ab1ea90b777a870
|
data/HISTORY.md
CHANGED
@@ -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
|
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 *
|
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)
|
data/lib/svmkit/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2018-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: numo-narray
|