svmkit 0.5.0 → 0.5.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: 3be3dae5adddfa8bf3655f983082f64601056ce2097671f97873f36f062eea15
4
- data.tar.gz: 44bb40d0ec91975d6e4948567f95103434f5792fb4a2be2b87b18079b0b7bb00
3
+ metadata.gz: 8f4ee565e18136b7f40832368ef78df514b7390a20929d40efb623d2ba7c0378
4
+ data.tar.gz: e05f3ff80b02ee41a7ce4c32cf6bc6cc99f30771ae9f719eb4fea716680da229
5
5
  SHA512:
6
- metadata.gz: a009b9403935760033ea14c2e7a3027953d28f38f27c3952f49ed69c035eea94ab7305dce4c4a9b3e688f9894eeb3f8511863c1f71640735d16f73e3a1afafe6
7
- data.tar.gz: ad9e8198c88047aad39e4caf95872c1616d1cdb94272f8044af621f7eb4990378693a7e0f3073ed0a7dbad3e2e22d7d46055fdb2795c3287ef23fa7efc7ea9d1
6
+ metadata.gz: 48cc0e18b0aa8a5ace9ceb07744249b799f61ffc04b177bbbb229529754c6e138f13dcd9f5ff04c2b61a380abcef01a6d0f4c175a86b7829c00aad9b91181521
7
+ data.tar.gz: 2b84b8983d392015dc30cb69851e4df11c4d1b30e6e521763179e648e239482c0fb508ccacf46e03cbbe8f2765b123df4a595a3f7f2a2384b0d1c0f085cd78fd
data/HISTORY.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 0.5.1
2
+ - Fix bug on class probability calculation of DecisionTreeClassifier.
3
+
1
4
  # 0.5.0
2
5
  - Add class for K-Means clustering.
3
6
  - Add class for evaluating purity.
@@ -112,8 +112,7 @@ module SVMKit
112
112
  # @return [Numo::DFloat] (shape: [n_samples, n_classes]) Predicted probability of each class per sample.
113
113
  def predict_proba(x)
114
114
  SVMKit::Validation.check_sample_array(x)
115
- probs = Numo::DFloat[*(Array.new(x.shape[0]) { |n| predict_at_node(@tree, x[n, true]) })]
116
- probs[true, @classes]
115
+ Numo::DFloat[*(Array.new(x.shape[0]) { |n| predict_at_node(@tree, x[n, true]) })]
117
116
  end
118
117
 
119
118
  # Return the index of the leaf that each sample reached.
@@ -214,11 +213,11 @@ module SVMKit
214
213
  end
215
214
 
216
215
  def put_leaf(node, y)
217
- node.probs = y.bincount(minlength: @classes.max + 1) / node.n_samples.to_f
216
+ node.probs = Numo::DFloat[*(@classes.to_a.map { |c| y.eq(c).count })] / node.n_samples
218
217
  node.leaf = true
219
218
  node.leaf_id = @n_leaves
220
219
  @n_leaves += 1
221
- @leaf_labels.push(node.probs.max_index)
220
+ @leaf_labels.push(@classes[node.probs.max_index])
222
221
  node
223
222
  end
224
223
 
@@ -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.5.0'.freeze
6
+ VERSION = '0.5.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.5.0
4
+ version: 0.5.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-06-14 00:00:00.000000000 Z
11
+ date: 2018-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: numo-narray