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 +4 -4
- data/HISTORY.md +3 -0
- data/lib/libsvmloader.rb +7 -3
- data/lib/libsvmloader/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ede917630e8badaa2eaf48ddf2b02a55c63a02b14d73b7a998967415be1229e4
|
4
|
+
data.tar.gz: 845c9d1cab9b51477f51ec32407b0da2ea7435d2589099d7799d8b03b383d6dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3494aae2eef9bdee84c4b12a605a7062773fb2aa76e329437e58aae0e236921651fb9f19c959c59d3ed29dd1d02b2aeecdbf7d6b6042a5f63c87118e881bdf3
|
7
|
+
data.tar.gz: e7d0080d47143336792efee4c166ad2c8f04a2e71c3c5d5800df55b9959ac47fa66744292ebbfbb45dccd209ea6cbe256a9f8c86a42016e112ba92dd99c4e90f
|
data/HISTORY.md
CHANGED
data/lib/libsvmloader.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
|
data/lib/libsvmloader/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2018-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|