Xmipp  v3.23.11-Nereus
svm_classifier.h
Go to the documentation of this file.
1 /***************************************************************************
2  *
3  * Authors: Enrique Recarte Llorens (erecallo@hotmail.com)
4  * Carlos Oscar S. Sorzano (coss@cnb.csic.es)
5  *
6  * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21  * 02111-1307 USA
22  *
23  * All comments concerning this program package may be sent to the
24  * e-mail address 'xmipp@cnb.csic.es'
25  ***************************************************************************/
26 
27 #ifndef XMIPP__SVM_CLASSIFIER_HH__
28 #define XMIPP__SVM_CLASSIFIER_HH__
29 
30 /* Includes ---------------------------------------------------------------- */
31 #include <libsvm/svm.h>
32 
33 template<typename T>
34 class MultidimArray;
35 class FileName;
36 
40 
46 {
47 public:
50  svm_model *model=nullptr;
51 public:
52  SVMClassifier()=default;
53 
55  {
56  *this=other;
57  }
58 
60  SVMClassifier & operator=(const SVMClassifier &other);
62  double predict(MultidimArray<double> &featVec,double &score);
63  void SaveModel(const FileName &fnModel);
64  void LoadModel(const FileName &fnModel);
65  void setParameters(double c,double gamma);
66 #ifdef UNUSED // detected as unused 29.6.2018
67  int getNumClasses();
68 #endif
69 };
71 #endif
SVMClassifier & operator=(const SVMClassifier &other)
SVMClassifier()=default
void LoadModel(const FileName &fnModel)
SVMClassifier(const SVMClassifier &other)
doublereal * c
svm_parameter param
void SaveModel(const FileName &fnModel)
double * gamma
svm_problem prob
Definition: svm.h:58
void setParameters(double c, double gamma)
double predict(MultidimArray< double > &featVec, double &score)
svm_model * model
void SVMTrain(MultidimArray< double > &trainSet, MultidimArray< double > &lable)