#include <svmClassification.h>
|
| | svmClassification (KernelType kernelType=LINEAR_KERNEL, SVMType svmType=C_SVC, bool useScaling=true, bool useNullRejection=false, bool useAutoGamma=true, float gamma=0.1, unsigned int degree=3, float coef0=0, float nu=0.5, float C=1, bool useCrossValidation=false, unsigned int kFoldValue=10) |
| |
| | svmClassification (int numInputs) |
| |
| | ~svmClassification () |
| |
| void | train (const std::vector< trainingExampleTemplate< T > > &trainingSet) |
| |
| T | run (const std::vector< T > &inputVector) |
| |
| void | reset () |
| |
| bool | init (KernelType kernelType, SVMType svmType, bool useScaling, bool useNullRejection, bool useAutoGamma, float gamma, unsigned int degree, float coef0, float nu, float C, bool useCrossValidation, unsigned int kFoldValue) |
| |
| int | getNumInputs () const |
| |
| std::vector< int > | getWhichInputs () const |
| |
| void | getJSONDescription (Json::Value ¤tModel) |
| |
| virtual | ~baseModel () |
| |
|
| template<typename TT > |
| Json::Value | vector2json (TT vec) |
| |
§ KernelType
| Enumerator |
|---|
| LINEAR_KERNEL | |
| POLY_KERNEL | |
| RBF_KERNEL | |
| SIGMOID_KERNEL | |
| PRECOMPUTED_KERNEL | |
§ SVMType
| Enumerator |
|---|
| C_SVC | |
| NU_SVC | |
| ONE_CLASS | |
| EPSILON_SVR | |
| NU_SVR | |
§ svmClassification() [1/2]
template<typename T >
| svmClassification< T >::svmClassification |
( |
KernelType |
kernelType = LINEAR_KERNEL, |
|
|
SVMType |
svmType = C_SVC, |
|
|
bool |
useScaling = true, |
|
|
bool |
useNullRejection = false, |
|
|
bool |
useAutoGamma = true, |
|
|
float |
gamma = 0.1, |
|
|
unsigned int |
degree = 3, |
|
|
float |
coef0 = 0, |
|
|
float |
nu = 0.5, |
|
|
float |
C = 1, |
|
|
bool |
useCrossValidation = false, |
|
|
unsigned int |
kFoldValue = 10 |
|
) |
| |
Default constructor.
Set the initial SVM settings, although these can be changed at any time using either init(...) function of the set... functions.
- Parameters
-
| kernelType | this sets the SVM kernelType. Options are LINEAR_KERNEL, POLY_KERNEL, RBF_KERNEL, SIGMOID_KERNEL, PRECOMPUTED_KERNEL. The default kernelType is kernelType=LINEAR_KERNEL |
| svmType | this sets the SVM type. Options are C_SVC, NU_SVC, ONE_CLASS, EPSILON_SVR, NU_SVR. The default svmType is svmType=C_SVC |
| useScaling | sets if the training/prediction data will be scaled to the default range of [-1. 1.]. The SVM algorithm commonly achieves a better classification result if scaling is turned on. The default useScaling value is useScaling=true |
| useNullRejection | sets if a predicted class will be rejected if the classes' probability is below the classificationThreshold. The default value is useNullRejection=false |
| useAutoGamma | sets if the SVM gamma parameter will automatically be computed, if set to true then gamma will be set to (1.0/numFeatures), where numFeatures is the number of features in the training data. The default value is useAutoGamma=true |
| gamma | sets the SVM gamma parameter. The default value is gamma=0.1 |
| degree | sets the SVM degree parameter. The default value is degree=3 |
| coef0 | sets the SVM coef0 parameter. The default value is coef0=0 |
| nu | sets the SVM nu parameter. The default value is nu=0.5 |
| C | sets the SVM C parameter. The default value is C=1 |
| useCrossValidation | sets if the SVM model will be trained using cross validation. The default value is useCrossValidation=false |
| kFoldValue | sets the number of folds that will be used for cross validation. The default value is kFoldValue=10 |
§ svmClassification() [2/2]
§ ~svmClassification()
§ getJSONDescription()
§ getNumInputs()
§ getWhichInputs()
§ init()
template<typename T >
| bool svmClassification< T >::init |
( |
KernelType |
kernelType, |
|
|
SVMType |
svmType, |
|
|
bool |
useScaling, |
|
|
bool |
useNullRejection, |
|
|
bool |
useAutoGamma, |
|
|
float |
gamma, |
|
|
unsigned int |
degree, |
|
|
float |
coef0, |
|
|
float |
nu, |
|
|
float |
C, |
|
|
bool |
useCrossValidation, |
|
|
unsigned int |
kFoldValue |
|
) |
| |
This initializes the SVM settings and parameters. Any previous model, settings, or problems will be cleared.
- Parameters
-
| kernelType | this sets the SVM kernelType. Options are LINEAR_KERNEL, POLY_KERNEL, RBF_KERNEL, SIGMOID_KERNEL, PRECOMPUTED_KERNEL |
| UINT | svmType: this sets the SVM type. Options are C_SVC, NU_SVC, ONE_CLASS, EPSILON_SVR, NU_SVR |
| useScaling | sets if the training/prediction data will be scaled to the default range of [-1. 1.]. The SVM algorithm commonly achieves a better classification result if scaling is turned on |
| useNullRejection | sets if a predicted class will be rejected if the classes' probability is below the classificationThreshold |
| useAutoGamma | sets if the SVM gamma parameter will automatically be computed, if set to true then gamma will be set to (1.0/numFeatures), where numFeatures is the number of features in the training data |
| gamma | sets the SVM gamma parameter |
| degree | sets the SVM degree parameter |
| coef0 | sets the SVM coef0 parameter |
| nu | sets the SVM nu parameter |
| C | sets the SVM C parameter |
| useCrossValidation | sets if the SVM model will be trained using cross validation |
| kFoldValue | sets the number of folds that will be used for cross validation |
- Returns
- returns true if the SVM was initialized, false otherwise
§ reset()
§ run()
Generate an output value from a single input vector.
- Parameters
-
| A | standard vector of doubles to be evaluated. |
- Returns
- A single double: the nearest class as determined by k-nearest neighbor.
Implements baseModel< T >.
§ train()
Fill the model with a vector of examples.
- Parameters
-
| The | training set is a vector of training examples that contain both a vector of input values and a double specifying desired output class. |
Implements baseModel< T >.
The documentation for this class was generated from the following files: