31 #include "CClassifier.h"
38 #define SVEXCP_BAD_LABEL "Illegal label detected! Label must be '+1' or '-1'."
39 #define SVEXCP_BAD_DATASET "Number of classes differs from two!"
41 #define WARNING_THRESHOLD 1e-11
60 class CSVM :
public CClassifier<Type> {
123 void classify (Type * ptVec, Type * ptClass, Type * ptMargin)
const;
129 bool isA(
const char* acClass)
const {
if(
string(acClass) ==
"CSVM")
return true;
else return CClassifier<Type>::isA(acClass);};
250 void updateGradient (
int& a,
double& tDeltaA,
int& b,
double& tDeltaB);
280 bool selectPair (
int *piI1,
int *piI2, Type & tError);
Type tWeightPos
Definition: CSVM.h:69
Type l2Regularizer(Type tClass)
TSVMType tSVMType
Definition: CSVM.h:78
Type tBias
Definition: CSVM.h:71
vector< int > tTransformedAccess
Definition: CSVM.h:82
string className() const
Definition: CSVM.h:127
IO_MODE
Definition: CObject.h:38
void optimizeWorkingSet()
void updateGradient(int &a, double &tDeltaA, int &b, double &tDeltaB)
Support Vector Machine algorithm for binary classifcation.
Definition: CSVM.h:60
void setMaxIterations(long lMax)
Definition: CSVM.h:101
bool serialize2(CArchiv &tA)
Type tC
Definition: CSVM.h:68
CDataset< Type > getNonSupportData() const
void setTerminationError(Type tMinError)
Definition: CSVM.h:159
bool bUnshrinked
Definition: CSVM.h:74
vector< CSVCandidate< Type > > tWorkingSet
Definition: CSVM.h:65
void setRegularization(Type tC)
CDenseVector< Type > tWeight
Definition: CSVM.h:79
bool checkShrinking(int, int)
long lNextShrink
Definition: CSVM.h:73
Type tWeightNeg
Definition: CSVM.h:69
bool selectPair(int *piI1, int *piI2, Type &tError)
CDataset< Type > getSupportData(bool bDropNonSV)
void setWeight(Type tWPos, Type tWNeg)
CKernelCache< Type > * ptCache
Definition: CSVM.h:66
TSVMType
Definition: CSVM.h:43
void analyticSolve(int i1, int i2)
Definition: CKernelCache.h:39
void trainChunking(CDataset< Type > &rtTrainset, int iStartSetSize, int iMaxChunkSize)
Type l1Regularizer(Type tClass)
CDenseVector< Type > getWeightVector() const
Definition: CSVM.h:213
Base class of object serialization.
Definition: CArchiv.h:19
long lMaxIterations
Definition: CSVM.h:72
bool isA(const char *acClass) const
Definition: CSVM.h:129
Base class for kernel functions Base class for kernel function used for example by the support vector...
Definition: CKernel.h:46
Template object for vectors of single and double precision and integer.
Definition: CDenseVector.h:37
templatized vector for numerical applications
Definition: CMatrix.h:39
Type bias() const
Definition: CSVM.h:220
Manages pairs of input and output vectors.
Definition: CDataset.h:110
Type tTerminationError
Definition: CSVM.h:70
int iCacheSize
Definition: CSVM.h:80
void setKernel(CKernel< Type > *ptKernel)
void train(const CDataset< Type > &tTrainSet)
void classify(const CVector< Type > &tVec, Type *ptClass, Type *ptMargin) const
bool bFoldKernel
Definition: CSVM.h:75
bool serialize(fstream &stream, IO_MODE mode)
CKernel< Type > * ptKernel
Definition: CSVM.h:67
const CKernel< Type > * kernel()
Definition: CSVM.h:184
int iNumIteration
Definition: CSVM.h:76
void setCacheSize(Type tSize)
Definition: CSVM.h:192
int iNumActiveItems
Definition: CSVM.h:77