![]() |
SG++-Doxygen-Documentation
|
Implementation of a support vector machine in primal formulation which additionally stores support vectors. More...
#include <PrimalDualSVM.hpp>
Public Member Functions | |
| void | add (sgpp::base::Grid &grid, sgpp::base::DataVector &x, double alpha, size_t dataDim) |
| Adds a data point to the set of support vectors. More... | |
| void | multiply (double scalar) |
| Scales the normal vector w. More... | |
| int | predict (sgpp::base::Grid &grid, sgpp::base::DataVector &x, size_t dataDim) |
| Class prediction for a given data point and grid. More... | |
| double | predictRaw (sgpp::base::Grid &grid, sgpp::base::DataVector &x, size_t dataDim, bool trans=false) |
| Raw prediction for a given data point and grid. More... | |
| PrimalDualSVM (size_t dim, size_t inputDim, size_t budget, bool useBias) | |
| Constructor. More... | |
| ~PrimalDualSVM () | |
| Destructor. More... | |
Public Attributes | |
| base::DataVector | alphas |
| base::DataVector | norms |
| base::DataMatrix | svs |
| base::DataVector | w |
| base::DataVector | w2 |
Protected Attributes | |
| double | bias |
| size_t | budget |
| bool | useBias |
Implementation of a support vector machine in primal formulation which additionally stores support vectors.
For non-linear classification, sparse grid kernels are applied.
| sgpp::datadriven::PrimalDualSVM::PrimalDualSVM | ( | size_t | dim, |
| size_t | inputDim, | ||
| size_t | budget, | ||
| bool | useBias | ||
| ) |
Constructor.
| dim | The dimension of the feature space (i.e. grid size) |
| inputDim | The dimension of the data |
| budget | The max number of support vectors |
| useBias | Indicates whether bias should be used |
References sgpp::base::DataMatrix::reserveAdditionalRows(), and svs.
| sgpp::datadriven::PrimalDualSVM::~PrimalDualSVM | ( | ) |
Destructor.
| void sgpp::datadriven::PrimalDualSVM::add | ( | sgpp::base::Grid & | grid, |
| sgpp::base::DataVector & | x, | ||
| double | alpha, | ||
| size_t | dataDim | ||
| ) |
Adds a data point to the set of support vectors.
| grid | The sparse grid which defines the transformation |
| x | The data point |
| alpha | The corresponding weight |
| dataDim | Dimension of x |
References sgpp::base::DataVector::add(), alpha, alphas, sgpp::base::DataVector::append(), sgpp::base::DataMatrix::appendRow(), bias, budget, sgpp::op_factory::createOperationMultipleEval(), sgpp::base::DataMatrix::getNrows(), sgpp::base::Grid::getSize(), sgpp::base::DataVector::mult(), norms, svs, useBias, w, and w2.
| void sgpp::datadriven::PrimalDualSVM::multiply | ( | double | scalar | ) |
Scales the normal vector w.
| scalar | The scaling factor |
References alphas, bias, sgpp::base::DataVector::getSize(), sgpp::base::DataVector::mult(), useBias, w, and w2.
| int sgpp::datadriven::PrimalDualSVM::predict | ( | sgpp::base::Grid & | grid, |
| sgpp::base::DataVector & | x, | ||
| size_t | dataDim | ||
| ) |
Class prediction for a given data point and grid.
| grid | The sparse grid which defines the transformation |
| x | The data point |
| dataDim | Dimension of x |
References predictRaw().
| double sgpp::datadriven::PrimalDualSVM::predictRaw | ( | sgpp::base::Grid & | grid, |
| sgpp::base::DataVector & | x, | ||
| size_t | dataDim, | ||
| bool | trans = false |
||
| ) |
Raw prediction for a given data point and grid.
| grid | The sparse grid which defines the transformation |
| x | The data point |
| dataDim | Dimension of x |
| trans | Indicates whether x is already transformed into feature space |
References bias, sgpp::op_factory::createOperationMultipleEval(), sgpp::base::DataVector::dotProduct(), sgpp::base::Grid::getSize(), sgpp::base::DataMatrix::setRow(), useBias, and w.
Referenced by predict().
| base::DataVector sgpp::datadriven::PrimalDualSVM::alphas |
Referenced by add(), and multiply().
|
protected |
Referenced by add(), multiply(), and predictRaw().
|
protected |
Referenced by add().
| base::DataVector sgpp::datadriven::PrimalDualSVM::norms |
Referenced by add().
| base::DataMatrix sgpp::datadriven::PrimalDualSVM::svs |
Referenced by add(), and PrimalDualSVM().
|
protected |
Referenced by add(), multiply(), and predictRaw().
| base::DataVector sgpp::datadriven::PrimalDualSVM::w |
Referenced by add(), multiply(), and predictRaw().
| base::DataVector sgpp::datadriven::PrimalDualSVM::w2 |
Referenced by add(), and multiply().