faif
|
#include <Svm.hpp>
Public Types | |
typedef std::vector< Val > | ClassifyExample |
typedef DomainVal::DomainType | AttrDomain |
typedef DomainVal::Value | AttrValue |
typedef Belief< DomainVal >::Beliefs | Beliefs |
Public Member Functions | |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int file_version) |
template<class Archive > | |
void | save (Archive &ar, const unsigned int) const |
template<class Archive > | |
void | load (Archive &ar, const unsigned int) |
SvmClassifier () | |
SvmClassifier (size_t dimension_, const AttrDomain &category_domain) | |
void | addExample (const ClassifyExample &example, const AttrValue &category) |
Beliefs | getCategories (const ClassifyExample &vec) |
Belief< DomainVal > | getCategory (const ClassifyExample &vec) |
void | train () |
size_t | getDimension () |
size_t | countTrainExamples () |
void | reset () |
void | resetAndChangeDimension (size_t) |
void | setC (Val C) |
void | setMargin (Val margin) |
void | setEpsilon (Val epsilon) |
void | setGaussParameter (Val gaussParameter) |
void | setPolynomialInhomogeneousParameter (Val polynomialInhomogeneousParameter) |
void | setPolynomialDegree (Val polynomialDegree) |
void | setTangentFrequency (Val tangentFrequency) |
void | setTangentShift (Val tangentShift) |
void | setFiniteStepsStopCondition (double stop) |
void | unsetFiniteStepsStopCondition () |
void | setSigmoidScaleFactor (Val sigmoidScaleFactor) |
void | setLinearKernel () |
void | setGaussKernel () |
void | setPolynomialKernel () |
void | setHyperbolicTangentKernel () |
Friends | |
class | boost::serialization::access |
serialization using boost::serialization More... | |
Support vector machine classifier class
typedef std::vector<Val> faif::ml::SvmClassifier< Val, DomainVal >::ClassifyExample |
Classify example is n-dimensional vector
typedef DomainVal::DomainType faif::ml::SvmClassifier< Val, DomainVal >::AttrDomain |
The attribute domain for learning
typedef DomainVal::Value faif::ml::SvmClassifier< Val, DomainVal >::AttrValue |
Attribute value representation in learning
typedef Belief<DomainVal>::Beliefs faif::ml::SvmClassifier< Val, DomainVal >::Beliefs |
Collection of pair (AttrIdd, Probability)
|
inline |
Empty c-tor
|
inline |
C-tor creates svm classifier for given dimensionality of a problem
References faif::ml::SvmClassifier< Val, DomainVal >::addExample(), faif::ml::SvmClassifier< Val, DomainVal >::countTrainExamples(), faif::ml::SvmClassifier< Val, DomainVal >::getCategories(), faif::ml::SvmClassifier< Val, DomainVal >::getCategory(), faif::ml::SvmClassifier< Val, DomainVal >::getDimension(), faif::ml::SvmClassifier< Val, DomainVal >::reset(), faif::ml::SvmClassifier< Val, DomainVal >::resetAndChangeDimension(), faif::ml::SvmClassifier< Val, DomainVal >::setC(), faif::ml::SvmClassifier< Val, DomainVal >::setEpsilon(), faif::ml::SvmClassifier< Val, DomainVal >::setFiniteStepsStopCondition(), faif::ml::SvmClassifier< Val, DomainVal >::setGaussKernel(), faif::ml::SvmClassifier< Val, DomainVal >::setGaussParameter(), faif::ml::SvmClassifier< Val, DomainVal >::setHyperbolicTangentKernel(), faif::ml::SvmClassifier< Val, DomainVal >::setLinearKernel(), faif::ml::SvmClassifier< Val, DomainVal >::setMargin(), faif::ml::SvmClassifier< Val, DomainVal >::setPolynomialDegree(), faif::ml::SvmClassifier< Val, DomainVal >::setPolynomialInhomogeneousParameter(), faif::ml::SvmClassifier< Val, DomainVal >::setPolynomialKernel(), faif::ml::SvmClassifier< Val, DomainVal >::setSigmoidScaleFactor(), faif::ml::SvmClassifier< Val, DomainVal >::setTangentFrequency(), faif::ml::SvmClassifier< Val, DomainVal >::setTangentShift(), faif::ml::SvmClassifier< Val, DomainVal >::train(), and faif::ml::SvmClassifier< Val, DomainVal >::unsetFiniteStepsStopCondition().
void faif::ml::SvmClassifier< Val, DomainVal >::addExample | ( | const ClassifyExample & | example, |
const AttrValue & | category | ||
) |
Add train example with known category to svm classifier
Referenced by faif::ml::SvmClassifier< Val, DomainVal >::SvmClassifier().
SvmClassifier< Val, DomainVal >::Beliefs faif::ml::SvmClassifier< Val, DomainVal >::getCategories | ( | const ClassifyExample & | vec | ) |
Classify and return all classes (svm assumption: two classes) with belief that the example is from given class
Referenced by faif::ml::SvmClassifier< Val, DomainVal >::getCategory(), and faif::ml::SvmClassifier< Val, DomainVal >::SvmClassifier().
Belief< DomainVal > faif::ml::SvmClassifier< Val, DomainVal >::getCategory | ( | const ClassifyExample & | vec | ) |
Classify and return the belief of the most probable class
References faif::ml::SvmClassifier< Val, DomainVal >::getCategories().
Referenced by faif::ml::SvmClassifier< Val, DomainVal >::SvmClassifier().
void faif::ml::SvmClassifier< Val, DomainVal >::train | ( | ) |
Use train example to train svm classifier
Referenced by faif::ml::SvmClassifier< Val, DomainVal >::SvmClassifier().
size_t faif::ml::SvmClassifier< Val, DomainVal >::getDimension | ( | ) |
Return dimensionality of a svm classifier
Referenced by faif::ml::SvmClassifier< Val, DomainVal >::SvmClassifier().
size_t faif::ml::SvmClassifier< Val, DomainVal >::countTrainExamples | ( | ) |
Return the number of train examples added to svm classifier
Referenced by faif::ml::SvmClassifier< Val, DomainVal >::SvmClassifier().
void faif::ml::SvmClassifier< Val, DomainVal >::reset | ( | ) |
Erase all the added train examples added to svm classifier
Referenced by faif::ml::SvmClassifier< Val, DomainVal >::SvmClassifier().
void faif::ml::SvmClassifier< Val, DomainVal >::resetAndChangeDimension | ( | size_t | _dimension | ) |
Erase all the added train examples added to svm classifier and change dimension of classifier
Referenced by faif::ml::SvmClassifier< Val, DomainVal >::SvmClassifier().
void faif::ml::SvmClassifier< Val, DomainVal >::setC | ( | Val | C | ) |
Set parameter C, should be >0
Referenced by faif::ml::SvmClassifier< Val, DomainVal >::SvmClassifier().
void faif::ml::SvmClassifier< Val, DomainVal >::setMargin | ( | Val | margin | ) |
Set parameter margin, should be >0
Referenced by faif::ml::SvmClassifier< Val, DomainVal >::SvmClassifier().
void faif::ml::SvmClassifier< Val, DomainVal >::setEpsilon | ( | Val | epsilon | ) |
Set parameter epsilon, should be >0
Referenced by faif::ml::SvmClassifier< Val, DomainVal >::SvmClassifier().
void faif::ml::SvmClassifier< Val, DomainVal >::setGaussParameter | ( | Val | gaussParameter | ) |
Set gaussian parameter t : exp(-t*||x1-x2||), should be >0
Referenced by faif::ml::SvmClassifier< Val, DomainVal >::SvmClassifier().
void faif::ml::SvmClassifier< Val, DomainVal >::setPolynomialInhomogeneousParameter | ( | Val | polynomialInhomogeneousParameter | ) |
Set parameter 'c' of hyperbolic tangent kernel function: tanh(w*x1.x2 - c)
Referenced by faif::ml::SvmClassifier< Val, DomainVal >::SvmClassifier().
void faif::ml::SvmClassifier< Val, DomainVal >::setPolynomialDegree | ( | Val | polynomialDegree | ) |
Set parameter 'd' of polynomial kernel function: (x1.x2 + c)^d
Referenced by faif::ml::SvmClassifier< Val, DomainVal >::SvmClassifier().
void faif::ml::SvmClassifier< Val, DomainVal >::setTangentFrequency | ( | Val | tangentFrequency | ) |
Set parameter 'w' of hyperbolic tangent kernel function: tanh(w*x1.x2 - c) , should be > 0
Referenced by faif::ml::SvmClassifier< Val, DomainVal >::SvmClassifier().
void faif::ml::SvmClassifier< Val, DomainVal >::setTangentShift | ( | Val | tangentShift | ) |
Set parameter 'c' of polynomial kernel function: (x1.x2 + c)^d , should be >= 0
Referenced by faif::ml::SvmClassifier< Val, DomainVal >::SvmClassifier().
void faif::ml::SvmClassifier< Val, DomainVal >::setFiniteStepsStopCondition | ( | double | stop | ) |
Set stop condition for SMO algorithm: when N training examples, SMO stops after stop*N steps. stop should be >0
Referenced by faif::ml::SvmClassifier< Val, DomainVal >::SvmClassifier().
void faif::ml::SvmClassifier< Val, DomainVal >::unsetFiniteStepsStopCondition | ( | ) |
Unset stop condition for SMO algorithm
Referenced by faif::ml::SvmClassifier< Val, DomainVal >::SvmClassifier().
void faif::ml::SvmClassifier< Val, DomainVal >::setSigmoidScaleFactor | ( | Val | sigmoidScaleFactor | ) |
Set parameter 'p' of sigmoid function: 1 / ( 1 + exp(-px) ), should be > 0
Referenced by faif::ml::SvmClassifier< Val, DomainVal >::SvmClassifier().
void faif::ml::SvmClassifier< Val, DomainVal >::setLinearKernel | ( | ) |
Set linear kernel for SMO algorithm
Referenced by faif::ml::SvmClassifier< Val, DomainVal >::SvmClassifier().
void faif::ml::SvmClassifier< Val, DomainVal >::setGaussKernel | ( | ) |
Set gaussian kernel for SMO algorithm
Referenced by faif::ml::SvmClassifier< Val, DomainVal >::SvmClassifier().
void faif::ml::SvmClassifier< Val, DomainVal >::setPolynomialKernel | ( | ) |
Set polynomial kernel for SMO algorithm
Referenced by faif::ml::SvmClassifier< Val, DomainVal >::SvmClassifier().
void faif::ml::SvmClassifier< Val, DomainVal >::setHyperbolicTangentKernel | ( | ) |
Set hyperbolic tangent kernel for SMO algorithm
Referenced by faif::ml::SvmClassifier< Val, DomainVal >::SvmClassifier().
|
friend |
serialization using boost::serialization