libsvmloader 0.2.0 → 0.2.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: e887dc00c4c665e3bf78221650a6740440cf9d07549c01bc47ccfb6940825ddd
4
- data.tar.gz: bff658751c419564ccbac3896307a2a1799d46ef7370fd5528e641f35073089b
3
+ metadata.gz: ede917630e8badaa2eaf48ddf2b02a55c63a02b14d73b7a998967415be1229e4
4
+ data.tar.gz: 845c9d1cab9b51477f51ec32407b0da2ea7435d2589099d7799d8b03b383d6dd
5
5
  SHA512:
6
- metadata.gz: ab4062fbd21fdddb5b139e6fef498234e04588e858f172042265f2f2ef33f9f06e60f147e52f56a022a12a2e10d527f3d0c6c64d815651a32cd6741ef488dadd
7
- data.tar.gz: 8ca0ffb36321df79bb6fd018d2e45d7a6c600371d852ef70ffad644eebcb7273dfb011f34596c3492cd9a1c42b13516ff8b8341df6d2d996e0d660613d3c809a
6
+ metadata.gz: f3494aae2eef9bdee84c4b12a605a7062773fb2aa76e329437e58aae0e236921651fb9f19c959c59d3ed29dd1d02b2aeecdbf7d6b6042a5f63c87118e881bdf3
7
+ data.tar.gz: e7d0080d47143336792efee4c166ad2c8f04a2e71c3c5d5800df55b9959ac47fa66744292ebbfbb45dccd209ea6cbe256a9f8c86a42016e112ba92dd99c4e90f
data/HISTORY.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 0.2.1
2
+ - Fixed the bug that failed to load if there is a space at the end of the line.
3
+
1
4
  # 0.2.0
2
5
  ## Breaking changes
3
6
 
@@ -50,11 +50,15 @@ class LibSVMLoader
50
50
 
51
51
  def parse_libsvm_row(row, zero_based, label_type, value_type)
52
52
  label = convert_type(row.shift, label_type)
53
- ftvec = row.map do |el|
53
+ adj_idx = zero_based == false ? 1 : 0
54
+ max_idx = -1
55
+ ftvec = []
56
+ while el = row.shift
54
57
  idx, val = el.split(':')
55
- [idx.to_i - (zero_based == false ? 1 : 0), convert_type(val, value_type)]
58
+ idx = idx.to_i - adj_idx
59
+ max_idx = idx if max_idx < idx
60
+ ftvec.push([idx, convert_type(val, value_type)])
56
61
  end
57
- max_idx = ftvec.map { |idx, _val| idx }.max || 0
58
62
  [label, ftvec, max_idx]
59
63
  end
60
64
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class LibSVMLoader
4
- VERSION = '0.2.0'.freeze
4
+ VERSION = '0.2.1'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libsvmloader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.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-08-25 00:00:00.000000000 Z
11
+ date: 2018-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler