SvmApproximation Class Reference

Approximation of Support Vector Machines (SVMs). More...

#include <SvmApproximation.h>

List of all members.

Public Types

enum  approximationAlgorithm { iRpropPlus, fixedPointIteration }
enum  approximationTarget { noSVs, classificationRateOnSVs }
enum  vectorGenerationMode { randomSelection, stochasticUniversalSampling, kMeansClustering }

Public Member Functions

 SvmApproximation (SVM *pSVM, bool verbose=false)
 constructor
 ~SvmApproximation ()
 destructor
float approximate ()
 approximate SVM
float gradientDescent ()
 perform gradient descent on overall model of approximated SVM (SVs and coefficients)
SVMgetApproximatedSVM ()
 return pointer to approximated SVM
void setApproximationAlgorithm (approximationAlgorithm aA)
 specify the algorithm for the approximation
void setVectorGenerationMode (int mode)
 specify technique for choosing initial vectors
void setApproximationTarget (approximationTarget aT)
 specify the goal iterate until the approximated SV consists of a specified number of SVs or until a certain classification on the SVs of the original SVM is achieved
void setTargetNoVecsForApproximatedSVM (unsigned noVecs)
 specify the number of the SVs for the approximated SVM only used if "approximationTarget" is set to "noSVs"
void setTargetClassificationRateOnSVsForApproximatedSVM (float classificationRate)
 specify the classification rate that should be achieved on the SVs of the original SVM only used if "approximationTarget" is set to "classificationRateOnSVs"
void setNoGradientDescentIterations (unsigned no)

Protected Member Functions

double error ()
 determine "difference" between original and approximated SVM
void addVecRprop ()
 optimize vector using iRpropPlus
void addVecFixPointIteration ()
 optimize using fixed-point iteration
bool calcOptimalAlphaOfApproximatedSVM ()
 calculate optimal coefficients for approx. SVM
bool calcOffsetForReducedModel ()
 calculate bias "b" for approx. SVM
float getClassificationRateOnSVsCorrectlyClassifiedByOrigSVM ()
 determine classification rate of approx. SVM on SVs of original SVM
void determineNoPositiveAndNegativeVectorsForApproximation ()
bool chooseVectorForNextIteration (Array< double > &vec)
 choose vector from original SVs
void createIndexListWithStochasticUniversalSampling ()
 choose initials vectors with k-means-clustering
void createIndexListWithKMeans ()

Protected Attributes

bool verbose
 in verbose mode the algorithm outputs some helpful comments to stdout.
SVMmpSVM
SVMmpApproximatedSVM
double * labels
Array< double > approximatedVectors
unsigned mNoExamplesOfOrigSVM
unsigned mDimension
unsigned mNoSVs
unsigned * mpNoExamplesOfApproximatedSVM
double mOffsetOfApproximatedSVM
unsigned mTargetNoVecsForApproximatedSVM
unsigned mTargetNoPositiveVectors
unsigned mTargetNoNegativeVectors
float mTargetClassificationRateForApproximatedSVM
approximationAlgorithm mApproximationAlgorithm
approximationTarget mApproximationTarget
KernelFunctionmpKernel
double mGamma
unsigned int mVectorGenerationMode
bool mbIsApproximatedModelValid
bool mbPerformedGradientDescent
unsigned mNoGradientDescentIterations
unsigned int mNoPositiveSVsOfOrigSVM
unsigned int mNoNegativeSVsOfOrigSVM
unsigned int mNoPositiveVecsDrawn
unsigned int mNoNegativeVecsDrawn
const char * mOutputDir
unsigned mIndexOfChosenVec
std::vector< int > * mpIndexListOfVecsForSelection

Friends

class SvmApproximationErrorFunction
class SvmApproximationErrorFunctionGlobal


Detailed Description

Approximation of Support Vector Machines (SVMs).

Author:
T. Suttorp
Date:
2006
The SvmApproximator class approximates the decision
function of an Shark-SVM object
Examples:

SvmApproximationExample.cpp.

Definition at line 61 of file SvmApproximation.h.


Member Enumeration Documentation

Enumerator:
iRpropPlus 
fixedPointIteration 

Definition at line 64 of file SvmApproximation.h.

Enumerator:
noSVs 
classificationRateOnSVs 

Definition at line 70 of file SvmApproximation.h.

Enumerator:
randomSelection 
stochasticUniversalSampling 
kMeansClustering 

Definition at line 76 of file SvmApproximation.h.


Constructor & Destructor Documentation

SvmApproximation::SvmApproximation ( SVM pSVM,
bool  verbose = false 
)

SvmApproximation::~SvmApproximation (  ) 

destructor

Definition at line 149 of file SvmApproximation.cpp.

References labels, and mpApproximatedSVM.


Member Function Documentation

void SvmApproximation::addVecFixPointIteration (  )  [protected]

void SvmApproximation::addVecRprop (  )  [protected]

float SvmApproximation::approximate (  ) 

bool SvmApproximation::calcOffsetForReducedModel (  )  [protected]

bool SvmApproximation::calcOptimalAlphaOfApproximatedSVM (  )  [protected]

bool SvmApproximation::chooseVectorForNextIteration ( Array< double > &  vec  )  [protected]

void SvmApproximation::createIndexListWithKMeans (  )  [protected]

void SvmApproximation::createIndexListWithStochasticUniversalSampling (  )  [protected]

choose initials vectors with k-means-clustering

Definition at line 751 of file SvmApproximation.cpp.

References SVM::getAlpha(), i, mNoExamplesOfOrigSVM, mpIndexListOfVecsForSelection, mpSVM, and mTargetNoVecsForApproximatedSVM.

Referenced by chooseVectorForNextIteration().

void SvmApproximation::determineNoPositiveAndNegativeVectorsForApproximation (  )  [protected]

double SvmApproximation::error (  )  [protected]

SVM* SvmApproximation::getApproximatedSVM (  )  [inline]

return pointer to approximated SVM

Examples:
SvmApproximationExample.cpp.

Definition at line 99 of file SvmApproximation.h.

References mpApproximatedSVM.

float SvmApproximation::getClassificationRateOnSVsCorrectlyClassifiedByOrigSVM (  )  [protected]

determine classification rate of approx. SVM on SVs of original SVM

Definition at line 883 of file SvmApproximation.cpp.

References SVM::getAlpha(), SVM::getPoints(), i, labels, mNoExamplesOfOrigSVM, SVM::model(), mpApproximatedSVM, and mpSVM.

Referenced by approximate().

float SvmApproximation::gradientDescent (  ) 

void SvmApproximation::setApproximationAlgorithm ( approximationAlgorithm  aA  )  [inline]

specify the algorithm for the approximation

Examples:
SvmApproximationExample.cpp.

Definition at line 105 of file SvmApproximation.h.

References mApproximationAlgorithm.

void SvmApproximation::setApproximationTarget ( approximationTarget  aT  )  [inline]

specify the goal iterate until the approximated SV consists of a specified number of SVs or until a certain classification on the SVs of the original SVM is achieved

Examples:
SvmApproximationExample.cpp.

Definition at line 114 of file SvmApproximation.h.

References mApproximationTarget.

void SvmApproximation::setNoGradientDescentIterations ( unsigned  no  )  [inline]

Examples:
SvmApproximationExample.cpp.

Definition at line 126 of file SvmApproximation.h.

References mNoGradientDescentIterations.

void SvmApproximation::setTargetClassificationRateOnSVsForApproximatedSVM ( float  classificationRate  )  [inline]

specify the classification rate that should be achieved on the SVs of the original SVM only used if "approximationTarget" is set to "classificationRateOnSVs"

Definition at line 123 of file SvmApproximation.h.

References mTargetClassificationRateForApproximatedSVM.

void SvmApproximation::setTargetNoVecsForApproximatedSVM ( unsigned  noVecs  )  [inline]

specify the number of the SVs for the approximated SVM only used if "approximationTarget" is set to "noSVs"

Examples:
SvmApproximationExample.cpp.

Definition at line 118 of file SvmApproximation.h.

References mTargetNoVecsForApproximatedSVM.

void SvmApproximation::setVectorGenerationMode ( int  mode  )  [inline]

specify technique for choosing initial vectors

Examples:
SvmApproximationExample.cpp.

Definition at line 109 of file SvmApproximation.h.

References mVectorGenerationMode.


Friends And Related Function Documentation

friend class SvmApproximationErrorFunction [friend]

Definition at line 201 of file SvmApproximation.h.

friend class SvmApproximationErrorFunctionGlobal [friend]

Definition at line 202 of file SvmApproximation.h.


Member Data Documentation

Array<double> SvmApproximation::approximatedVectors [protected]

double* SvmApproximation::labels [protected]

Definition at line 178 of file SvmApproximation.h.

Referenced by approximate(), setApproximationAlgorithm(), and SvmApproximation().

Definition at line 179 of file SvmApproximation.h.

Referenced by approximate(), setApproximationTarget(), and SvmApproximation().

Definition at line 186 of file SvmApproximation.h.

Referenced by gradientDescent(), and SvmApproximation().

unsigned SvmApproximation::mDimension [protected]

double SvmApproximation::mGamma [protected]

Definition at line 182 of file SvmApproximation.h.

Referenced by addVecRprop(), gradientDescent(), and SvmApproximation().

Definition at line 197 of file SvmApproximation.h.

Referenced by addVecFixPointIteration(), and chooseVectorForNextIteration().

Definition at line 191 of file SvmApproximation.h.

Referenced by SvmApproximation().

unsigned int SvmApproximation::mNoNegativeVecsDrawn [protected]

unsigned int SvmApproximation::mNoPositiveVecsDrawn [protected]

unsigned SvmApproximation::mNoSVs [protected]

Definition at line 172 of file SvmApproximation.h.

Referenced by calcOffsetForReducedModel().

const char* SvmApproximation::mOutputDir [protected]

Definition at line 195 of file SvmApproximation.h.

std::vector<int>* SvmApproximation::mpIndexListOfVecsForSelection [protected]

unsigned int SvmApproximation::mVectorGenerationMode [protected]

bool SvmApproximation::verbose [protected]

in verbose mode the algorithm outputs some helpful comments to stdout.

Definition at line 131 of file SvmApproximation.h.

Referenced by addVecFixPointIteration(), approximate(), calcOptimalAlphaOfApproximatedSVM(), and gradientDescent().


The documentation for this class was generated from the following files: