#include <iostream>#include <fstream>#include <cstdio>#include <cassert>#include <cmath>#include <stdlib.h>#include "Svm.h"#include "liatools.h"
Go to the source code of this file.
Classes | |
| struct | Svm_Hyperplane |
Defines | |
| #define | ALIZE_Svm_cpp |
| #define | INF HUGE_VAL |
| #define | TAU 1e-12 |
Functions | |
| double | getC (Matrix< double > train) |
| svm_parameter | definesParameter (Config &config, Matrix< double > &mat) |
| void | readProblem (Matrix< double > &inputProb, RealVector< double > &labels, struct svm_problem &prob, struct svm_parameter ¶m, struct svm_node *x_space) |
| void | concat (Matrix< double > &RES, Matrix< double > &A) |
| void | copyLine (Matrix< double > &RES, Matrix< double > &X, unsigned long idx) |
| void | copy (Matrix< double > &X, Matrix< double > &D) |
| void | loadHyperplane (String &filename, struct Svm_Hyperplane &h, Config &config) |
| void | getHyperplane (struct Svm_Hyperplane &h, const svm_model *model, RealVector< double > &labels, Config &config) |
| void | saveHyperplane (struct Svm_Hyperplane &h, String &outputFilename, Config &config) |
| void | predict (Matrix< double > &testInstances, String &model, RealVector< double > &scores, Config &config) |
| XLine | loadBck (Matrix< double > &Bck, Config &config) |
| int | svmTrain (Config &config) |
| int | svmPredict (Config &config) |
| int | svmPredictTnorm (Config &config) |
| double | dotProduct (DoubleVector &v1, DoubleVector &v2) |
| void concat | ( | Matrix< double > & | RES, |
| Matrix< double > & | A | ||
| ) |
Definition at line 150 of file Svm.cpp.
Referenced by svmTrain().
| void copy | ( | Matrix< double > & | X, |
| Matrix< double > & | D | ||
| ) |
Definition at line 163 of file Svm.cpp.
Referenced by svmTrain().
| void copyLine | ( | Matrix< double > & | RES, |
| Matrix< double > & | X, | ||
| unsigned long | idx | ||
| ) |
Definition at line 158 of file Svm.cpp.
Referenced by loadBck(), svmPredict(), and svmPredictTnorm().
| svm_parameter definesParameter | ( | Config & | config, |
| Matrix< double > & | mat | ||
| ) |
Definition at line 89 of file Svm.cpp.
References svm_parameter::C, C_SVC, svm_parameter::cache_size, svm_parameter::coef0, svm_parameter::degree, svm_parameter::eps, getC(), svm_parameter::kernel_type, LINEAR, svm_parameter::nr_weight, svm_parameter::nu, svm_parameter::p, svm_parameter::probability, svm_parameter::shrinking, svm_parameter::svm_type, verbose, svm_parameter::weight, and svm_parameter::weight_label.
Referenced by svmTrain().
| double getC | ( | Matrix< double > | train ) |
Definition at line 77 of file Svm.cpp.
Referenced by definesParameter().
| void getHyperplane | ( | struct Svm_Hyperplane & | h, |
| const svm_model * | model, | ||
| RealVector< double > & | labels, | ||
| Config & | config | ||
| ) |
Definition at line 190 of file Svm.cpp.
References svm_model::l, Svm_Hyperplane::offset, svm_model::rho, svm_model::SV, svm_model::sv_coef, svm_node::value, and Svm_Hyperplane::w.
Referenced by svmTrain().
| XLine loadBck | ( | Matrix< double > & | Bck, |
| Config & | config | ||
| ) |
Definition at line 247 of file Svm.cpp.
References copyLine(), verbose, and verboseLevel.
Referenced by svmTrain().
| void loadHyperplane | ( | String & | filename, |
| struct Svm_Hyperplane & | h, | ||
| Config & | config | ||
| ) |
Definition at line 181 of file Svm.cpp.
References Svm_Hyperplane::offset, and Svm_Hyperplane::w.
Referenced by predict().
| void predict | ( | Matrix< double > & | testInstances, |
| String & | model, | ||
| RealVector< double > & | scores, | ||
| Config & | config | ||
| ) |
Definition at line 219 of file Svm.cpp.
References loadHyperplane(), Svm_Hyperplane::offset, verbose, and Svm_Hyperplane::w.
Referenced by svmPredict(), and svmPredictTnorm().
| void readProblem | ( | Matrix< double > & | inputProb, |
| RealVector< double > & | labels, | ||
| struct svm_problem & | prob, | ||
| struct svm_parameter & | param, | ||
| struct svm_node * | x_space | ||
| ) |
Definition at line 124 of file Svm.cpp.
References svm_node::index, svm_problem::l, svm_node::value, verbose, svm_problem::x, and svm_problem::y.
Referenced by svmTrain().
| void saveHyperplane | ( | struct Svm_Hyperplane & | h, |
| String & | outputFilename, | ||
| Config & | config | ||
| ) |
Definition at line 208 of file Svm.cpp.
References Svm_Hyperplane::offset, and Svm_Hyperplane::w.
Referenced by svmTrain().
| int svmPredict | ( | Config & | config ) |
Definition at line 364 of file Svm.cpp.
References copyLine(), outputResultLine(), predict(), verbose, and verboseLevel.
| int svmPredictTnorm | ( | Config & | config ) |
Definition at line 408 of file Svm.cpp.
References copyLine(), outputResultLine(), predict(), verbose, and verboseLevel.
| int svmTrain | ( | Config & | config ) |
Tnorm is a special case, just change the labels and do not touch to the matrix
Definition at line 274 of file Svm.cpp.
References concat(), copy(), definesParameter(), error_msg, getHyperplane(), svm_model::l, svm_problem::l, loadBck(), readProblem(), saveHyperplane(), svm_model::sv_coef, svm_check_parameter(), svm_destroy_model(), svm_destroy_param(), svm_train(), verbose, verboseLevel, svm_problem::x, and svm_problem::y.
1.7.2