libsvmloader 0.1.1 → 0.1.2

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
  SHA1:
3
- metadata.gz: 6dd47447989d49679eb08906fed4b769599010d4
4
- data.tar.gz: e72c3f971474f334d77a6cc023177234df573134
3
+ metadata.gz: feb8cd299e4b1221e3c6cb4c2d2b006890f70a55
4
+ data.tar.gz: 99e4bcd0831930025f00bf00b72cc8063ea22a96
5
5
  SHA512:
6
- metadata.gz: 12d4211f18451f7cd05784692d723cfdd2d44d316bab57b6b914692ad74105dd7afa109dc1c5f9e0c54e028534132076f77f2dbd68ad671ed4e0a5e9e0bd978f
7
- data.tar.gz: 4707aa881f45015ccdc307aec89c7f6cce5e8007774b9951537aeb6a8e742bfc5b77409580355f462a290c80e1238a84f1b9d995f5f6e561332f4689786f24e9
6
+ metadata.gz: a0a83f69953b4fabebde09baff9e674723d8e2c05960caf3d390a6cacb520b077bdc515d27a2dc63c60e21720ced6569ce5151fef477df0472301231406101cd
7
+ data.tar.gz: 4da38d07e12770f2072837c34545398d41ad77f6b15d2e6f94805b2f236dd5e39d76acb2b6319ff4a6b99213a943bdd83e2c2796404b14719815e72dfca3f2ac
@@ -0,0 +1,8 @@
1
+ Metrics/LineLength:
2
+ Max: 120
3
+
4
+ Metrics/ModuleLength:
5
+ Max: 200
6
+
7
+ Metrics/ClassLength:
8
+ Max: 200
@@ -0,0 +1,9 @@
1
+ # 0.1.2
2
+ - Changed the way to read a file.
3
+
4
+ # 0.1.1
5
+ - Fixed to fail reading zero vectors.
6
+
7
+ # 0.1.0
8
+ - Added basic class.
9
+ - Added the methods that read and write a file with libsvm format.
@@ -16,18 +16,15 @@ class LibSVMLoader
16
16
  # @return [Array<NMatrix>]
17
17
  # Returns array containing the (n_samples x n_features) matrix for feature vectors
18
18
  # and (n_samples x 1) matrix for labels or target values.
19
- def load_libsvm_file(filename, zero_based: false, stype: :yale,
20
- label_dtype: :int32, value_dtype: :float64)
19
+ def load_libsvm_file(filename, zero_based: false, stype: :yale, label_dtype: :int32, value_dtype: :float64)
21
20
  ftvecs = []
22
21
  labels = []
23
22
  n_features = 0
24
- File.open(filename, 'r') do |file|
25
- file.each_line do |line|
26
- label, ftvec, max_idx = parse_libsvm_line(line, zero_based)
27
- labels.push(label)
28
- ftvecs.push(ftvec)
29
- n_features = [n_features, max_idx].max
30
- end
23
+ File.read(filename).split("\n").each do |line|
24
+ label, ftvec, max_idx = parse_libsvm_line(line, zero_based)
25
+ labels.push(label)
26
+ ftvecs.push(ftvec)
27
+ n_features = [n_features, max_idx].max
31
28
  end
32
29
  [convert_to_nmatrix(ftvecs, n_features, value_dtype, stype),
33
30
  NMatrix.new([labels.size, 1], labels, dtype: label_dtype)]
@@ -1,11 +1,3 @@
1
- #module LibSVMLoader
2
- # VERSION = "0.1.0"
3
- #end
4
1
  class LibSVMLoader
5
- module VERSION
6
- MAJOR = 0
7
- MINOR = 1
8
- TINY = 1
9
- STRING = [MAJOR, MINOR, TINY].compact.join('.')
10
- end
2
+ VERSION = '0.1.2'.freeze
11
3
  end
@@ -5,7 +5,7 @@ require "libsvmloader/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "libsvmloader"
8
- spec.version = LibSVMLoader::VERSION::STRING
8
+ spec.version = LibSVMLoader::VERSION
9
9
  spec.authors = ["yoshoku"]
10
10
  spec.email = ["yoshoku@outlook.com"]
11
11
 
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.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - yoshoku
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-11 00:00:00.000000000 Z
11
+ date: 2017-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -76,9 +76,11 @@ extra_rdoc_files: []
76
76
  files:
77
77
  - ".gitignore"
78
78
  - ".rspec"
79
+ - ".rubocop.yml"
79
80
  - ".travis.yml"
80
81
  - CODE_OF_CONDUCT.md
81
82
  - Gemfile
83
+ - HISTORY.md
82
84
  - LICENSE.txt
83
85
  - README.md
84
86
  - Rakefile