numo-libsvm 1.0.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,31 @@
1
+
2
+ Copyright (c) 2000-2019 Chih-Chung Chang and Chih-Jen Lin
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions
7
+ are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright
10
+ notice, this list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ 3. Neither name of copyright holders nor the names of its contributors
17
+ may be used to endorse or promote products derived from this software
18
+ without specific prior written permission.
19
+
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
25
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File without changes
File without changes
@@ -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.2'
6
+ VERSION = '2.0.0'
7
7
  end
8
8
  end
@@ -0,0 +1,65 @@
1
+ module Numo
2
+ module Libsvm
3
+ module SvmType
4
+ C_SVC: Integer
5
+ NU_SVC: Integer
6
+ ONE_CLASS: Integer
7
+ EPSILON_SVR: Integer
8
+ NU_SVR: Integer
9
+ end
10
+
11
+ module KenelType
12
+ LINEAR: Integer
13
+ POLY: Integer
14
+ RBF: Integer
15
+ SIGMOID: Integer
16
+ PRECOMPUTED: Integer
17
+ end
18
+
19
+ LIBSVM_VERSION: Integer
20
+ VERSION: String
21
+
22
+ type model = {
23
+ nr_class: Integer,
24
+ l: Integer,
25
+ SV: Numo::DFloat,
26
+ sv_coef: Numo::DFloat,
27
+ rho: Numo::DFloat,
28
+ probA: Numo::DFloat,
29
+ probB: Numo::DFloat,
30
+ sv_indices: Numo::Int32,
31
+ label: Numo::Int32,
32
+ nSV: Numo::Int32,
33
+ free_sv: Integer
34
+ }
35
+
36
+ type param = {
37
+ svm_type: Integer?,
38
+ kernel_type: Integer?,
39
+ degree: Integer?,
40
+ gamma: Float?,
41
+ coef0: Float?,
42
+ cache_size: Float?,
43
+ eps: Float?,
44
+ C: Float?,
45
+ nr_weight: Integer?,
46
+ weight_label: Numo::Int32?,
47
+ weight: Numo::DFloat?,
48
+ nu: Float?,
49
+ p: Float?,
50
+ shrinking: bool?,
51
+ probability: bool?,
52
+ verbose: bool?,
53
+ random_seed: Integer?
54
+ }
55
+
56
+ def self?.cv: (Numo::DFloat x, Numo::DFloat y, param, Integer n_folds) -> Numo::DFloat
57
+ def self?.train: (Numo::DFloat x, Numo::DFloat y, param) -> model
58
+ def self?.predict: (Numo::DFloat x, param, model) -> Numo::DFloat
59
+ def self?.predict_proba: (Numo::DFloat x, param, model) -> Numo::DFloat
60
+ def self?.decision_function: (Numo::DFloat x, param, model) -> Numo::DFloat
61
+ def self?.save_svm_model: (String filename, param, model) -> bool
62
+ def self?.load_svm_model: (String filename) -> [param, model]
63
+ end
64
+ end
65
+
metadata CHANGED
@@ -1,85 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: numo-libsvm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - yoshoku
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-23 00:00:00.000000000 Z
11
+ date: 2022-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: numo-narray
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.9.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.9.1
27
- - !ruby/object:Gem::Dependency
28
- name: bundler
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '2.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '2.0'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '12.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '12.0'
55
- - !ruby/object:Gem::Dependency
56
- name: rake-compiler
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '1.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '1.0'
69
- - !ruby/object:Gem::Dependency
70
- name: rspec
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '3.0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '3.0'
83
27
  description: |
84
28
  Numo::Libsvm is a Ruby gem binding to the LIBSVM library.
85
29
  LIBSVM is one of the famous libraries that implemented Support Vector Machines,
@@ -92,36 +36,18 @@ extensions:
92
36
  - ext/numo/libsvm/extconf.rb
93
37
  extra_rdoc_files: []
94
38
  files:
95
- - ".github/workflows/build.yml"
96
- - ".gitignore"
97
- - ".gitmodules"
98
- - ".rspec"
99
39
  - CHANGELOG.md
100
- - CODE_OF_CONDUCT.md
101
- - Gemfile
102
40
  - LICENSE.txt
103
41
  - README.md
104
- - Rakefile
105
- - ext/numo/libsvm/converter.c
106
- - ext/numo/libsvm/converter.h
107
42
  - ext/numo/libsvm/extconf.rb
108
- - ext/numo/libsvm/kernel_type.c
109
- - ext/numo/libsvm/kernel_type.h
110
- - ext/numo/libsvm/libsvm/svm.cpp
111
- - ext/numo/libsvm/libsvm/svm.h
112
- - ext/numo/libsvm/libsvmext.c
113
- - ext/numo/libsvm/libsvmext.h
114
- - ext/numo/libsvm/svm_model.c
115
- - ext/numo/libsvm/svm_model.h
116
- - ext/numo/libsvm/svm_parameter.c
117
- - ext/numo/libsvm/svm_parameter.h
118
- - ext/numo/libsvm/svm_problem.c
119
- - ext/numo/libsvm/svm_problem.h
120
- - ext/numo/libsvm/svm_type.c
121
- - ext/numo/libsvm/svm_type.h
43
+ - ext/numo/libsvm/libsvmext.cpp
44
+ - ext/numo/libsvm/libsvmext.hpp
45
+ - ext/numo/libsvm/src/COPYRIGHT
46
+ - ext/numo/libsvm/src/svm.cpp
47
+ - ext/numo/libsvm/src/svm.h
122
48
  - lib/numo/libsvm.rb
123
49
  - lib/numo/libsvm/version.rb
124
- - numo-libsvm.gemspec
50
+ - sig/numo/libsvm.rbs
125
51
  homepage: https://github.com/yoshoku/numo-libsvm
126
52
  licenses:
127
53
  - BSD-3-Clause
@@ -144,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
70
  - !ruby/object:Gem::Version
145
71
  version: '0'
146
72
  requirements: []
147
- rubygems_version: 3.2.3
73
+ rubygems_version: 3.3.3
148
74
  signing_key:
149
75
  specification_version: 4
150
76
  summary: Numo::Libsvm is a Ruby gem binding to the LIBSVM library. Numo::Libsvm makes
@@ -1,27 +0,0 @@
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
data/.gitignore DELETED
@@ -1,20 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- /bin/
11
-
12
- # rspec failure tracking
13
- .rspec_status
14
-
15
- *.swp
16
- *.bundle
17
- mkmf.log
18
- tags
19
- .DS_Store
20
- .ruby-version
data/.gitmodules DELETED
@@ -1,3 +0,0 @@
1
- [submodule "ext/numo/libsvm/libsvm"]
2
- path = ext/numo/libsvm/libsvm
3
- url = https://github.com/cjlin1/libsvm.git
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at yoshoku@outlook.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in numo-libsvm.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,15 +0,0 @@
1
- require 'bundler/gem_tasks'
2
- require 'rspec/core/rake_task'
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- require 'rake/extensiontask'
7
-
8
- task :build => :compile
9
-
10
- Rake::ExtensionTask.new('libsvmext') do |ext|
11
- ext.ext_dir = 'ext/numo/libsvm'
12
- ext.lib_dir = 'lib/numo/libsvm'
13
- end
14
-
15
- task :default => [:clobber, :compile, :spec]
@@ -1,204 +0,0 @@
1
-
2
- #include "converter.h"
3
-
4
- VALUE int_vec_to_nary(int* const arr, int const size)
5
- {
6
- int i;
7
- size_t shape[1] = { size };
8
- VALUE v = rb_narray_new(numo_cInt32, 1, shape);
9
- int32_t* vp = (int32_t*)na_get_pointer_for_write(v);
10
- for (i = 0; i < size; i++) { vp[i] = (int32_t)arr[i]; }
11
- return v;
12
- }
13
-
14
- int* nary_to_int_vec(VALUE vec_val)
15
- {
16
- int i;
17
- int n_elements;
18
- narray_t* vec_nary;
19
- int32_t* vec_pt;
20
- int* vec;
21
-
22
- if (vec_val == Qnil) return NULL;
23
-
24
- GetNArray(vec_val, vec_nary);
25
- n_elements = (int)NA_SHAPE(vec_nary)[0];
26
-
27
- vec = ALLOC_N(int, n_elements);
28
- vec_pt = (int32_t*)na_get_pointer_for_read(vec_val);
29
- for (i = 0; i < n_elements; i++) { vec[i] = (int)vec_pt[i]; }
30
-
31
- RB_GC_GUARD(vec_val);
32
-
33
- return vec;
34
- }
35
-
36
- VALUE dbl_vec_to_nary(double* const arr, int const size)
37
- {
38
- int i;
39
- size_t shape[1] = { size };
40
- VALUE v = rb_narray_new(numo_cDFloat, 1, shape);
41
- double* vp = (double*)na_get_pointer_for_write(v);
42
- for (i = 0; i < size; i++) { vp[i] = arr[i]; }
43
- return v;
44
- }
45
-
46
- double* nary_to_dbl_vec(VALUE vec_val)
47
- {
48
- int n_elements;
49
- narray_t* vec_nary;
50
- double* vec_pt;
51
- double* vec;
52
-
53
- if (vec_val == Qnil) return NULL;
54
-
55
- GetNArray(vec_val, vec_nary);
56
- n_elements = (int)NA_SHAPE(vec_nary)[0];
57
-
58
- vec = ALLOC_N(double, n_elements);
59
- vec_pt = (double*)na_get_pointer_for_read(vec_val);
60
- memcpy(vec, vec_pt, n_elements * sizeof(double));
61
-
62
- RB_GC_GUARD(vec_val);
63
-
64
- return vec;
65
- }
66
-
67
- VALUE dbl_mat_to_nary(double** const mat, int const n_rows, int const n_cols)
68
- {
69
- int i, j;
70
- size_t shape[2] = { n_rows, n_cols };
71
- VALUE v = rb_narray_new(numo_cDFloat, 2, shape);
72
- double* vp = (double*)na_get_pointer_for_write(v);
73
-
74
- for (i = 0; i < n_rows; i++) {
75
- for (j = 0; j < n_cols; j++) {
76
- vp[i * n_cols + j] = mat[i][j];
77
- }
78
- }
79
-
80
- return v;
81
- }
82
-
83
- double** nary_to_dbl_mat(VALUE mat_val)
84
- {
85
- int i, j;
86
- int n_rows, n_cols;
87
- narray_t* mat_nary;
88
- double* mat_pt;
89
- double** mat;
90
-
91
- if (mat_val == Qnil) return NULL;
92
-
93
- GetNArray(mat_val, mat_nary);
94
- n_rows = (int)NA_SHAPE(mat_nary)[0];
95
- n_cols = (int)NA_SHAPE(mat_nary)[1];
96
-
97
- mat_pt = (double*)na_get_pointer_for_read(mat_val);
98
- mat = ALLOC_N(double*, n_rows);
99
- for (i = 0; i < n_rows; i++) {
100
- mat[i] = ALLOC_N(double, n_cols);
101
- for (j = 0; j < n_cols; j++) {
102
- mat[i][j] = mat_pt[i * n_cols + j];
103
- }
104
- }
105
-
106
- RB_GC_GUARD(mat_val);
107
-
108
- return mat;
109
- }
110
-
111
- VALUE svm_nodes_to_nary(struct svm_node** const support_vecs, const int n_support_vecs)
112
- {
113
- int i, j;
114
- int n_dimensions = 0;
115
- size_t shape[2] = { n_support_vecs, 1 };
116
- VALUE v;
117
- double* vp;
118
-
119
- for (i = 0; i < n_support_vecs; i++) {
120
- for (j = 0; support_vecs[i][j].index != -1; j++) {
121
- if (n_dimensions < support_vecs[i][j].index) {
122
- n_dimensions = support_vecs[i][j].index;
123
- }
124
- }
125
- }
126
-
127
- shape[1] = n_dimensions;
128
- v = rb_narray_new(numo_cDFloat, 2, shape);
129
- vp = (double*)na_get_pointer_for_write(v);
130
- memset(vp, 0, n_support_vecs * n_dimensions * sizeof(double));
131
-
132
- for (i = 0; i < n_support_vecs; i++) {
133
- for (j = 0; support_vecs[i][j].index != -1; j++) {
134
- vp[i * n_dimensions + support_vecs[i][j].index - 1] = support_vecs[i][j].value;
135
- }
136
- }
137
-
138
- return v;
139
- }
140
-
141
- struct svm_node** nary_to_svm_nodes(VALUE nary_val)
142
- {
143
- int i, j, k;
144
- int n_rows, n_cols, n_nonzero_cols;
145
- narray_t* nary;
146
- double* nary_pt;
147
- struct svm_node** support_vecs;
148
-
149
- if (nary_val == Qnil) return NULL;
150
-
151
- GetNArray(nary_val, nary);
152
- n_rows = (int)NA_SHAPE(nary)[0];
153
- n_cols = (int)NA_SHAPE(nary)[1];
154
-
155
- nary_pt = (double*)na_get_pointer_for_read(nary_val);
156
- support_vecs = ALLOC_N(struct svm_node*, n_rows);
157
- for (i = 0; i < n_rows; i++) {
158
- n_nonzero_cols = 0;
159
- for (j = 0; j < n_cols; j++) {
160
- if (nary_pt[i * n_cols + j] != 0) {
161
- n_nonzero_cols++;
162
- }
163
- }
164
- support_vecs[i] = ALLOC_N(struct svm_node, n_nonzero_cols + 1);
165
- for (j = 0, k = 0; j < n_cols; j++) {
166
- if (nary_pt[i * n_cols + j] != 0) {
167
- support_vecs[i][k].index = j + 1;
168
- support_vecs[i][k].value = nary_pt[i * n_cols + j];
169
- k++;
170
- }
171
- }
172
- support_vecs[i][n_nonzero_cols].index = -1;
173
- support_vecs[i][n_nonzero_cols].value = 0.0;
174
- }
175
-
176
- RB_GC_GUARD(nary_val);
177
-
178
- return support_vecs;
179
- }
180
-
181
- struct svm_node* dbl_vec_to_svm_node(double* const arr, int const size)
182
- {
183
- int i, j;
184
- int n_nonzero_elements;
185
- struct svm_node* node;
186
-
187
- n_nonzero_elements = 0;
188
- for (i = 0; i < size; i++) {
189
- if (arr[i] != 0.0) n_nonzero_elements++;
190
- }
191
-
192
- node = ALLOC_N(struct svm_node, n_nonzero_elements + 1);
193
- for (i = 0, j = 0; i < size; i++) {
194
- if (arr[i] != 0.0) {
195
- node[j].index = i + 1;
196
- node[j].value = arr[i];
197
- j++;
198
- }
199
- }
200
- node[n_nonzero_elements].index = -1;
201
- node[n_nonzero_elements].value = 0.0;
202
-
203
- return node;
204
- }
@@ -1,20 +0,0 @@
1
- #ifndef NUMO_LIBSVM_CONVERTER_H
2
- #define NUMO_LIBSVM_CONVERTER_H 1
3
-
4
- #include <string.h>
5
- #include <svm.h>
6
- #include <ruby.h>
7
- #include <numo/narray.h>
8
- #include <numo/template.h>
9
-
10
- VALUE int_vec_to_nary(int* const arr, int const size);
11
- int* nary_to_int_vec(VALUE vec_val);
12
- VALUE dbl_vec_to_nary(double* const arr, int const size);
13
- double* nary_to_dbl_vec(VALUE vec_val);
14
- VALUE dbl_mat_to_nary(double** const mat, int const n_rows, int const n_cols);
15
- double** nary_to_dbl_mat(VALUE mat_val);
16
- VALUE svm_nodes_to_nary(struct svm_node** const support_vecs, const int n_support_vecs);
17
- struct svm_node** nary_to_svm_nodes(VALUE nary_val);
18
- struct svm_node* dbl_vec_to_svm_node(double* const arr, int const size);
19
-
20
- #endif /* NUMO_LIBSVM_CONVERTER_H */
@@ -1,22 +0,0 @@
1
- #include "kernel_type.h"
2
-
3
- RUBY_EXTERN VALUE mLibsvm;
4
-
5
- void rb_init_kernel_type_module()
6
- {
7
- /**
8
- * Document-module: Numo::Libsvm::KernelType
9
- * The module consisting of constants for kernel type that used for parameter of LIBSVM.
10
- */
11
- VALUE mKernelType = rb_define_module_under(mLibsvm, "KernelType");
12
- /* Linear kernel; u' * v */
13
- rb_define_const(mKernelType, "LINEAR", INT2NUM(LINEAR));
14
- /* Polynomial kernel; (gamma * u' * v + coef0)^degree */
15
- rb_define_const(mKernelType, "POLY", INT2NUM(POLY));
16
- /* RBF kernel; exp(-gamma * ||u - v||^2) */
17
- rb_define_const(mKernelType, "RBF", INT2NUM(RBF));
18
- /* Sigmoid kernel; tanh(gamma * u' * v + coef0) */
19
- rb_define_const(mKernelType, "SIGMOID", INT2NUM(SIGMOID));
20
- /* Precomputed kernel */
21
- rb_define_const(mKernelType, "PRECOMPUTED", INT2NUM(PRECOMPUTED));
22
- }
@@ -1,9 +0,0 @@
1
- #ifndef NUMO_LIBSVM_KERNEL_TYPE_H
2
- #define NUMO_LIBSVM_KERNEL_TYPE_H 1
3
-
4
- #include <svm.h>
5
- #include <ruby.h>
6
-
7
- void rb_init_kernel_type_module();
8
-
9
- #endif /* NUMO_LIBSVM_KERNEL_TYPE_H */