numo-libsvm 1.0.0 → 1.0.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
- SHA1:
3
- metadata.gz: c0a730ce303204c97607bd8c5ce7bf6440fe3526
4
- data.tar.gz: 5370997eadf0f407239763a6fc31241538f06758
2
+ SHA256:
3
+ metadata.gz: '049939ac19f6b660182096f07e08e5191e76f09a91ea639e9d04b79fa85f2f2f'
4
+ data.tar.gz: ee2e9ceaff7c17604505590df3266817a4df7ba0e334e99ce04b909abaf379c3
5
5
  SHA512:
6
- metadata.gz: 5ba7e42f36ec3f7fff0d42c900f79500a61695efe03f4b0cd74a6f2758e92ecc80172006f3186e4567feb322572943b31332f1147263aef5f257ea960379936c
7
- data.tar.gz: da34b077e7d299c0c7a760ecbf02b395f95606e4f87deb9e060de3330ad5ae507f81fe3d1b7dbbadfd4b54c3161af049a27302a5554249f7f7b17766a204f1aa
6
+ metadata.gz: 7fca5bc012281d8350260e01037001741dfd23439560a53765c1594f1202edac47e5b3eefa9c0e50659e96d83d1959473f6cd4892c36ac218d96ed69ec8833e3
7
+ data.tar.gz: 4d4681a436044f0cf011a55c051081a45a8789a6b188be359f1569f0a846344dfbd4a24f164282a87172d119185b1d3b878d1274c494265e79220215ffb0399c
@@ -0,0 +1,27 @@
1
+ name: build
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ ruby: [ '2.5', '2.6', '2.7' ]
11
+ steps:
12
+ - uses: actions/checkout@v2
13
+ - name: Checkout submodule
14
+ shell: bash
15
+ run: |
16
+ auth_header="$(git config --local --get http.https://github.com/.extraheader)"
17
+ git submodule sync --recursive
18
+ git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
19
+ - name: Set up Ruby ${{ matrix.ruby }}
20
+ uses: actions/setup-ruby@v1
21
+ with:
22
+ ruby-version: ${{ matrix.ruby }}
23
+ - name: Build and test with Rake
24
+ run: |
25
+ gem install bundler
26
+ bundle install --jobs 4 --retry 3
27
+ bundle exec rake
@@ -1,3 +1,7 @@
1
+ # 1.0.1
2
+ - Add GC guard codes.
3
+ - Fix some configuration files.
4
+
1
5
  # 1.0.0
2
6
  ## Breaking change
3
7
  - For easy installation, Numo::LIBSVM bundles LIBSVM codes.
@@ -1,4 +1,4 @@
1
- Copyright (c) 2019 Atsushi Tatsuma
1
+ Copyright (c) 2019-2021 Atsushi Tatsuma
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # Numo::Libsvm
2
2
 
3
- [![Build Status](https://travis-ci.org/yoshoku/numo-libsvm.svg?branch=master)](https://travis-ci.org/yoshoku/numo-libsvm)
3
+ [![Build Status](https://github.com/yoshoku/numo-libsvm/workflows/build/badge.svg)](https://github.com/yoshoku/numo-libsvm/actions?query=workflow%3Abuild)
4
4
  [![Gem Version](https://badge.fury.io/rb/numo-libsvm.svg)](https://badge.fury.io/rb/numo-libsvm)
5
- [![BSD 3-Clause License](https://img.shields.io/badge/License-BSD%203--Clause-orange.svg)](https://github.com/yoshoku/numo-libsvm/blob/master/LICENSE.txt)
6
- [![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](https://www.rubydoc.info/gems/numo-libsvm/0.4.0)
5
+ [![BSD 3-Clause License](https://img.shields.io/badge/License-BSD%203--Clause-orange.svg)](https://github.com/yoshoku/numo-libsvm/blob/main/LICENSE.txt)
6
+ [![Documentation](https://img.shields.io/badge/api-reference-blue.svg)](https://yoshoku.github.io/numo-libsvm/doc/)
7
7
 
8
8
  Numo::Libsvm is a Ruby gem binding to the [LIBSVM](https://github.com/cjlin1/libsvm) library.
9
9
  LIBSVM is one of the famous libraries that implemented Support Vector Machines,
@@ -158,7 +158,7 @@ Accuracy: 98.3 %
158
158
  ### Note
159
159
  The hyperparameter of SVM is given with Ruby Hash on Numo::Libsvm.
160
160
  The hash key of hyperparameter and its meaning match the struct svm_parameter of LIBSVM.
161
- The svm_parameter is detailed in [LIBSVM README](https://github.com/cjlin1/libsvm/blob/master/README).
161
+ The svm_parameter is detailed in [LIBSVM README](https://github.com/cjlin1/libsvm/blob/main/README).
162
162
 
163
163
  ```ruby
164
164
  param = {
@@ -197,4 +197,4 @@ The gem is available as open source under the terms of the [BSD-3-Clause License
197
197
 
198
198
  ## Code of Conduct
199
199
 
200
- Everyone interacting in the Numo::Libsvm project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/yoshoku/numo-libsvm/blob/master/CODE_OF_CONDUCT.md).
200
+ Everyone interacting in the Numo::Libsvm project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/yoshoku/numo-libsvm/blob/main/CODE_OF_CONDUCT.md).
@@ -28,6 +28,8 @@ int* nary_to_int_vec(VALUE vec_val)
28
28
  vec_pt = (int32_t*)na_get_pointer_for_read(vec_val);
29
29
  for (i = 0; i < n_elements; i++) { vec[i] = (int)vec_pt[i]; }
30
30
 
31
+ RB_GC_GUARD(vec_val);
32
+
31
33
  return vec;
32
34
  }
33
35
 
@@ -57,6 +59,8 @@ double* nary_to_dbl_vec(VALUE vec_val)
57
59
  vec_pt = (double*)na_get_pointer_for_read(vec_val);
58
60
  memcpy(vec, vec_pt, n_elements * sizeof(double));
59
61
 
62
+ RB_GC_GUARD(vec_val);
63
+
60
64
  return vec;
61
65
  }
62
66
 
@@ -99,6 +103,8 @@ double** nary_to_dbl_mat(VALUE mat_val)
99
103
  }
100
104
  }
101
105
 
106
+ RB_GC_GUARD(mat_val);
107
+
102
108
  return mat;
103
109
  }
104
110
 
@@ -167,6 +173,8 @@ struct svm_node** nary_to_svm_nodes(VALUE nary_val)
167
173
  support_vecs[i][n_nonzero_cols].value = 0.0;
168
174
  }
169
175
 
176
+ RB_GC_GUARD(nary_val);
177
+
170
178
  return support_vecs;
171
179
  }
172
180
 
@@ -114,6 +114,9 @@ VALUE train(VALUE self, VALUE x_val, VALUE y_val, VALUE param_hash)
114
114
  xfree_svm_problem(problem);
115
115
  xfree_svm_parameter(param);
116
116
 
117
+ RB_GC_GUARD(x_val);
118
+ RB_GC_GUARD(y_val);
119
+
117
120
  return model_hash;
118
121
  }
119
122
 
@@ -229,6 +232,9 @@ VALUE cross_validation(VALUE self, VALUE x_val, VALUE y_val, VALUE param_hash, V
229
232
  xfree_svm_problem(problem);
230
233
  xfree_svm_parameter(param);
231
234
 
235
+ RB_GC_GUARD(x_val);
236
+ RB_GC_GUARD(y_val);
237
+
232
238
  return t_val;
233
239
  }
234
240
 
@@ -295,6 +301,8 @@ VALUE predict(VALUE self, VALUE x_val, VALUE param_hash, VALUE model_hash)
295
301
  xfree_svm_model(model);
296
302
  xfree_svm_parameter(param);
297
303
 
304
+ RB_GC_GUARD(x_val);
305
+
298
306
  return y_val;
299
307
  }
300
308
 
@@ -385,6 +393,8 @@ VALUE decision_function(VALUE self, VALUE x_val, VALUE param_hash, VALUE model_h
385
393
  xfree_svm_model(model);
386
394
  xfree_svm_parameter(param);
387
395
 
396
+ RB_GC_GUARD(x_val);
397
+
388
398
  return y_val;
389
399
  }
390
400
 
@@ -460,6 +470,8 @@ VALUE predict_proba(VALUE self, VALUE x_val, VALUE param_hash, VALUE model_hash)
460
470
  xfree_svm_model(model);
461
471
  xfree_svm_parameter(param);
462
472
 
473
+ RB_GC_GUARD(x_val);
474
+
463
475
  return y_val;
464
476
  }
465
477
 
@@ -83,5 +83,8 @@ struct svm_problem* dataset_to_svm_problem(VALUE x_val, VALUE y_val)
83
83
  problem->y[i] = y_pt[i];
84
84
  }
85
85
 
86
+ RB_GC_GUARD(x_val);
87
+ RB_GC_GUARD(y_val);
88
+
86
89
  return problem;
87
90
  }
@@ -3,6 +3,6 @@
3
3
  module Numo
4
4
  module Libsvm
5
5
  # The version of Numo::Libsvm you are using.
6
- VERSION = '1.0.0'
6
+ VERSION = '1.0.1'
7
7
  end
8
8
  end
@@ -49,7 +49,7 @@ Gem::Specification.new do |spec|
49
49
  spec.add_runtime_dependency 'numo-narray', '~> 0.9.1'
50
50
 
51
51
  spec.add_development_dependency 'bundler', '~> 2.0'
52
- spec.add_development_dependency 'rake', '~> 10.0'
52
+ spec.add_development_dependency 'rake', '~> 12.0'
53
53
  spec.add_development_dependency 'rake-compiler', '~> 1.0'
54
54
  spec.add_development_dependency 'rspec', '~> 3.0'
55
55
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: numo-libsvm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - yoshoku
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-12 00:00:00.000000000 Z
11
+ date: 2021-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: numo-narray
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '12.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '12.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake-compiler
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -92,10 +92,10 @@ extensions:
92
92
  - ext/numo/libsvm/extconf.rb
93
93
  extra_rdoc_files: []
94
94
  files:
95
+ - ".github/workflows/build.yml"
95
96
  - ".gitignore"
96
97
  - ".gitmodules"
97
98
  - ".rspec"
98
- - ".travis.yml"
99
99
  - CHANGELOG.md
100
100
  - CODE_OF_CONDUCT.md
101
101
  - Gemfile
@@ -129,7 +129,7 @@ metadata:
129
129
  homepage_uri: https://github.com/yoshoku/numo-libsvm
130
130
  source_code_uri: https://github.com/yoshoku/numo-libsvm
131
131
  documentation_uri: https://yoshoku.github.io/numo-libsvm/doc/
132
- post_install_message:
132
+ post_install_message:
133
133
  rdoc_options: []
134
134
  require_paths:
135
135
  - lib
@@ -144,9 +144,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  requirements: []
147
- rubyforge_project:
148
- rubygems_version: 2.6.14.4
149
- signing_key:
147
+ rubygems_version: 3.1.4
148
+ signing_key:
150
149
  specification_version: 4
151
150
  summary: Numo::Libsvm is a Ruby gem binding to the LIBSVM library. Numo::Libsvm makes
152
151
  to use the LIBSVM functions with dataset represented by Numo::NArray.
@@ -1,13 +0,0 @@
1
- ---
2
- sudo: true
3
- os: linux
4
- dist: bionic
5
- language: ruby
6
- cache: bundler
7
- rvm:
8
- - '2.4'
9
- - '2.5'
10
- - '2.6'
11
-
12
- before_install:
13
- - gem install bundler -v 2.0.2