numo-libsvm 2.1.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/LICENSE.txt +1 -1
- data/ext/numo/libsvm/libsvmext.cpp +1 -1
- data/ext/numo/libsvm/libsvmext.hpp +1 -1
- data/ext/numo/libsvm/src/COPYRIGHT +1 -1
- data/ext/numo/libsvm/src/svm.cpp +20 -6
- data/ext/numo/libsvm/src/svm.h +1 -1
- data/lib/numo/libsvm/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: 1e4eb5d7c2a7e1bde6c1987e2f235d66954715d13c894b732f45686c944f632b
|
4
|
+
data.tar.gz: 1a2839e141f0160328aaae9cbd7e2b85f4bf500f880dbbc94599c2568fb04e27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f115624dc61595a4bc6298c055e4a0a3bbecd12aad2645b8c2869fd62d036f0d874a6884ec351b589f4acb315ff09d58dc6e4a0df71cd992bc9cf8d96e07ab8
|
7
|
+
data.tar.gz: cd04639c40579d3f1aa2ba88ddf62e1510cd7d1b7f224acd04866eaf075bede38063ecb84b018cc3f0bcd7831f6a5c26149f8221abbe31b6d50d4e06a24268ef
|
data/CHANGELOG.md
CHANGED
data/LICENSE.txt
CHANGED
data/ext/numo/libsvm/src/svm.cpp
CHANGED
@@ -8,6 +8,10 @@
|
|
8
8
|
#include <limits.h>
|
9
9
|
#include <locale.h>
|
10
10
|
#include "svm.h"
|
11
|
+
#ifdef _OPENMP
|
12
|
+
#include <omp.h>
|
13
|
+
#endif
|
14
|
+
|
11
15
|
int libsvm_version = LIBSVM_VERSION;
|
12
16
|
typedef float Qfloat;
|
13
17
|
typedef signed char schar;
|
@@ -1282,6 +1286,9 @@ public:
|
|
1282
1286
|
int start, j;
|
1283
1287
|
if((start = cache->get_data(i,&data,len)) < len)
|
1284
1288
|
{
|
1289
|
+
#ifdef _OPENMP
|
1290
|
+
#pragma omp parallel for private(j) schedule(guided)
|
1291
|
+
#endif
|
1285
1292
|
for(j=start;j<len;j++)
|
1286
1293
|
data[j] = (Qfloat)(y[i]*y[j]*(this->*kernel_function)(i,j));
|
1287
1294
|
}
|
@@ -1397,6 +1404,9 @@ public:
|
|
1397
1404
|
int j, real_i = index[i];
|
1398
1405
|
if(cache->get_data(real_i,&data,l) < l)
|
1399
1406
|
{
|
1407
|
+
#ifdef _OPENMP
|
1408
|
+
#pragma omp parallel for private(j) schedule(guided)
|
1409
|
+
#endif
|
1400
1410
|
for(j=0;j<l;j++)
|
1401
1411
|
data[j] = (Qfloat)(this->*kernel_function)(real_i,j);
|
1402
1412
|
}
|
@@ -2219,11 +2229,9 @@ svm_model *svm_train(const svm_problem *prob, const svm_parameter *param)
|
|
2219
2229
|
double *prob_density_marks = Malloc(double,nr_marks);
|
2220
2230
|
|
2221
2231
|
if(svm_one_class_probability(prob,model,prob_density_marks) == 0)
|
2222
|
-
|
2223
|
-
|
2224
|
-
|
2225
|
-
model->prob_density_marks[i] = prob_density_marks[i];
|
2226
|
-
}
|
2232
|
+
model->prob_density_marks = prob_density_marks;
|
2233
|
+
else
|
2234
|
+
free(prob_density_marks);
|
2227
2235
|
}
|
2228
2236
|
|
2229
2237
|
free(f.alpha);
|
@@ -2436,8 +2444,8 @@ void svm_cross_validation(const svm_problem *prob, const svm_parameter *param, i
|
|
2436
2444
|
int nr_class;
|
2437
2445
|
if (nr_fold > l)
|
2438
2446
|
{
|
2447
|
+
fprintf(stderr,"WARNING: # folds (%d) > # data (%d). Will use # folds = # data instead (i.e., leave-one-out cross validation)\n", nr_fold, l);
|
2439
2448
|
nr_fold = l;
|
2440
|
-
fprintf(stderr,"WARNING: # folds > # data. Will use # folds = # data instead (i.e., leave-one-out cross validation)\n");
|
2441
2449
|
}
|
2442
2450
|
fold_start = Malloc(int,nr_fold+1);
|
2443
2451
|
// stratified cv may not give leave-one-out rate
|
@@ -2598,6 +2606,9 @@ double svm_predict_values(const svm_model *model, const svm_node *x, double* dec
|
|
2598
2606
|
{
|
2599
2607
|
double *sv_coef = model->sv_coef[0];
|
2600
2608
|
double sum = 0;
|
2609
|
+
#ifdef _OPENMP
|
2610
|
+
#pragma omp parallel for private(i) reduction(+:sum) schedule(guided)
|
2611
|
+
#endif
|
2601
2612
|
for(i=0;i<model->l;i++)
|
2602
2613
|
sum += sv_coef[i] * Kernel::k_function(x,model->SV[i],model->param);
|
2603
2614
|
sum -= model->rho[0];
|
@@ -2614,6 +2625,9 @@ double svm_predict_values(const svm_model *model, const svm_node *x, double* dec
|
|
2614
2625
|
int l = model->l;
|
2615
2626
|
|
2616
2627
|
double *kvalue = Malloc(double,l);
|
2628
|
+
#ifdef _OPENMP
|
2629
|
+
#pragma omp parallel for private(i) schedule(guided)
|
2630
|
+
#endif
|
2617
2631
|
for(i=0;i<l;i++)
|
2618
2632
|
kvalue[i] = Kernel::k_function(x,model->SV[i],model->param);
|
2619
2633
|
|
data/ext/numo/libsvm/src/svm.h
CHANGED
data/lib/numo/libsvm/version.rb
CHANGED
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: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yoshoku
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: numo-narray
|