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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f21522e68f65ccd9ed42fe54021f4a8cf7327ffaf8912d0a0d81266bc9529818
4
- data.tar.gz: 6e2b184199cebb97def06d38dd148a7f5da7972ecceeff37f42d0fb68ca8ff18
3
+ metadata.gz: 1e4eb5d7c2a7e1bde6c1987e2f235d66954715d13c894b732f45686c944f632b
4
+ data.tar.gz: 1a2839e141f0160328aaae9cbd7e2b85f4bf500f880dbbc94599c2568fb04e27
5
5
  SHA512:
6
- metadata.gz: 3bdf8b9a267b188129675424bcf7cfe3b2e92ec6798237dc610624dabdd9dbbae03a3d188f136b790d32502e5f0e53583ead91c08e66ee2bd194cc4455431e79
7
- data.tar.gz: eae8fb9bcac73b6550a27ea076d8cb15442159d6f2ae53dbcc5bbdf730b2b37aa47bca3244f6fe209c2cd39a551ab13faf05f6436f0bc4893877e3aa79a9e3dd
6
+ metadata.gz: 7f115624dc61595a4bc6298c055e4a0a3bbecd12aad2645b8c2869fd62d036f0d874a6884ec351b589f4acb315ff09d58dc6e4a0df71cd992bc9cf8d96e07ab8
7
+ data.tar.gz: cd04639c40579d3f1aa2ba88ddf62e1510cd7d1b7f224acd04866eaf075bede38063ecb84b018cc3f0bcd7831f6a5c26149f8221abbe31b6d50d4e06a24268ef
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 2.2.0
2
+ - Update bundled LIBSVM to 3.31.
3
+
1
4
  # 2.1.1
2
5
  - Fix build failure with Xcode 14 and Ruby 3.1.x.
3
6
 
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2019-2022 Atsushi Tatsuma
1
+ Copyright (c) 2019-2023 Atsushi Tatsuma
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2019-2022 Atsushi Tatsuma
2
+ * Copyright (c) 2019-2023 Atsushi Tatsuma
3
3
  * All rights reserved.
4
4
  *
5
5
  * Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2019-2022 Atsushi Tatsuma
2
+ * Copyright (c) 2019-2023 Atsushi Tatsuma
3
3
  * All rights reserved.
4
4
  *
5
5
  * Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
 
2
- Copyright (c) 2000-2019 Chih-Chung Chang and Chih-Jen Lin
2
+ Copyright (c) 2000-2023 Chih-Chung Chang and Chih-Jen Lin
3
3
  All rights reserved.
4
4
 
5
5
  Redistribution and use in source and binary forms, with or without
@@ -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
- model->prob_density_marks = Malloc(double,nr_marks);
2224
- for(i=0;i<nr_marks;i++)
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
 
@@ -1,7 +1,7 @@
1
1
  #ifndef _LIBSVM_H
2
2
  #define _LIBSVM_H
3
3
 
4
- #define LIBSVM_VERSION 330
4
+ #define LIBSVM_VERSION 331
5
5
 
6
6
  #ifdef __cplusplus
7
7
  extern "C" {
@@ -3,6 +3,6 @@
3
3
  module Numo
4
4
  module Libsvm
5
5
  # The version of Numo::Libsvm you are using.
6
- VERSION = '2.1.1'
6
+ VERSION = '2.2.0'
7
7
  end
8
8
  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: 2.1.1
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: 2022-11-27 00:00:00.000000000 Z
11
+ date: 2023-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: numo-narray