damina::AbstractSVM Class Reference

An abstract class which implements the basics for the Support Vector Machines. More...

#include <AbstractSVM.h>

Inheritance diagram for damina::AbstractSVM:

Inheritance graph
[legend]
Collaboration diagram for damina::AbstractSVM:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 AbstractSVM ()
 Constructor.
virtual void classify (DataSet *)=0
virtual void classify ()=0
virtual void disableShrinkingHeuristics ()
 Disable the Shrinking Heuristics.
virtual void enableShrinkingHeuristics ()
 Enable the Shrinking Heuristics.
virtual double getCacheSize ()
 Returns the current kernel cache size.
virtual int getKernel ()
 Returns the current kernel type.
virtual int getKernelDegree ()
 Returns the degree of the current kernel.
virtual double getKernelWidth ()
 Returns the gamma of the current kernel.
virtual struct svm_parameter * getParameters ()
 Returns the SVM paramters.
virtual DataSetgetTestSet ()
 Returns the current test set.
virtual double getTolerance ()
 Returns the tolerance of the stopping criteria.
virtual DataSetgetTrainingSet ()
 Returns the current training set.
virtual bool isShrinkingHeuristicsEnabled ()
 Returns true if the Shrinking is enabled.
virtual void learn (DataSet *)=0
virtual void learn ()=0
virtual void setCacheSize (int)
 Set the kernel cache size.
virtual void setKernel (int, int, double)
 Set the kernel type, the kernel degree and the kernel width for the SVM.
virtual void setKernel (int, double)
 Set both the kernel type and the kernel width (gamma) for the SVM.
virtual void setKernel (int, int)
 Set both the kernel type and the kernel degree for the SVM.
virtual void setKernel (int)
 Set the kernel type for the SVM.
virtual void setKernelDegree (int)
 Set the kernel degree for the SVM.
virtual void setKernelWidth (double)
 Set the kernel width (gamma) for the SVM.
virtual void setTestSet (DataSet *)
 Set the test set.
virtual void setTolerance (double)
 Set the tolerance of termination criterion.
virtual void setTrainingSet (DataSet *)
 Set the training set.
virtual ~AbstractSVM ()
 Destructor.

Protected Attributes

svm_parameter * params
 The configuration parameters for set up an SVM using LibSVM.
DataSettestSet
 The test set.
DataSettrainingSet
 The training set.

Detailed Description

An abstract class which implements the basics for the Support Vector Machines.

The class was built around the LibSVM library: C. Chang and C. Lin, LIBSVM: A Library for Support Vector Machines, 2001.

Author:
Vincenzo Russo - vincenzo.russo@neminis.org

Definition at line 19 of file AbstractSVM.h.


Constructor & Destructor Documentation

damina::AbstractSVM::AbstractSVM (  ) 

Constructor.

Definition at line 9 of file AbstractSVM.cpp.

References testSet.

00009                                  {
00010                 testSet = NULL;         
00011         }

damina::AbstractSVM::~AbstractSVM (  )  [virtual]

Destructor.

Definition at line 16 of file AbstractSVM.cpp.

References testSet, and trainingSet.

00016                                   {
00017                 delete trainingSet;
00018                 if (testSet != NULL) delete testSet;
00019         }


Member Function Documentation

virtual void damina::ClassificationEngine::classify ( DataSet  )  [pure virtual, inherited]

Implemented in damina::OneClassSVM.

virtual void damina::ClassificationEngine::classify (  )  [pure virtual, inherited]

Implemented in damina::OneClassSVM.

void damina::AbstractSVM::disableShrinkingHeuristics (  )  [virtual]

Disable the Shrinking Heuristics.

Since for many problems the number of free support vectors is small, the shrinking technique reduces the size of the working problem without considering some bounded variables.

References: T. Joachims, "Making large-scale support vector machine learning practical," , Schölkopf, B., Burges, C., and Smola, A., Eds., MIT Press, Cambridge, MA, 1998.

Definition at line 251 of file AbstractSVM.cpp.

References params.

00251                                                      {
00252                 this->params->shrinking = 0;
00253         }

void damina::AbstractSVM::enableShrinkingHeuristics (  )  [virtual]

Enable the Shrinking Heuristics.

Since for many problems the number of free support vectors is small, the shrinking technique reduces the size of the working problem without considering some bounded variables.

References: T. Joachims, "Making large-scale support vector machine learning practical," , Schölkopf, B., Burges, C., and Smola, A., Eds., MIT Press, Cambridge, MA, 1998.

Definition at line 235 of file AbstractSVM.cpp.

References params.

00235                                                     {
00236                 this->params->shrinking = 1;
00237         }

double damina::AbstractSVM::getCacheSize (  )  [virtual]

Returns the current kernel cache size.

Returns:
The size, in MBytes, of the current kernel cache

Definition at line 219 of file AbstractSVM.cpp.

References params.

00219                                          {
00220                 return this->params->cache_size;
00221         }

int damina::AbstractSVM::getKernel (  )  [virtual]

Returns the current kernel type.

Returns:
The kernel type

Definition at line 181 of file AbstractSVM.cpp.

References params.

Referenced by damina::SVClustering::getKernelType().

00181                                    {
00182                 return this->params->kernel_type;
00183         }

Here is the caller graph for this function:

int damina::AbstractSVM::getKernelDegree (  )  [virtual]

Returns the degree of the current kernel.

Returns:
The kernel degree

Definition at line 191 of file AbstractSVM.cpp.

References params.

00191                                          {
00192                 return this->params->degree;
00193         }

double damina::AbstractSVM::getKernelWidth (  )  [virtual]

Returns the gamma of the current kernel.

Returns:
The gamma of the kernel

Definition at line 200 of file AbstractSVM.cpp.

References params.

Referenced by damina::SVClustering::getKernelWidth().

00200                                            {
00201                 return this->params->gamma;
00202         }

Here is the caller graph for this function:

struct svm_parameter * damina::AbstractSVM::getParameters (  )  [read, virtual]

Returns the SVM paramters.

Returns:
The whole set of SVM parameters

Definition at line 279 of file AbstractSVM.cpp.

References params.

Referenced by damina::SVClustering::getParameters().

00279                                                          {
00280                 return params;
00281         }

Here is the caller graph for this function:

DataSet * damina::AbstractSVM::getTestSet (  )  [virtual]

Returns the current test set.

Returns:
The test set

Implements damina::LearningEngine.

Definition at line 161 of file AbstractSVM.cpp.

References testSet.

00161                                          {
00162                 return this->testSet;
00163         }

double damina::AbstractSVM::getTolerance (  )  [virtual]

Returns the tolerance of the stopping criteria.

Returns:
The value of the tolerance parameter for stopping criteria

Definition at line 210 of file AbstractSVM.cpp.

References params.

00210                                          {
00211                 return this->params->eps;
00212         }

DataSet * damina::AbstractSVM::getTrainingSet (  )  [virtual]

Returns the current training set.

Returns:
The training set

Implements damina::LearningEngine.

Definition at line 171 of file AbstractSVM.cpp.

References trainingSet.

Referenced by damina::SVClustering::getTrainingSet(), and damina::OneClassSVM::trainingSetToProblem().

00171                                              {
00172                 return this->trainingSet;
00173         }

Here is the caller graph for this function:

bool damina::AbstractSVM::isShrinkingHeuristicsEnabled (  )  [virtual]

Returns true if the Shrinking is enabled.

False otherwise.

Since for many problems the number of free support vectors is small, the shrinking technique reduces the size of the working problem without considering some bounded variables.

References: T. Joachims, "Making large-scale support vector machine learning practical," , Schölkopf, B., Burges, C., and Smola, A., Eds., MIT Press, Cambridge, MA, 1998.

Returns:
True if the Shrinking is enabled. False otherwise.

Definition at line 267 of file AbstractSVM.cpp.

00267                                                        {
00268                 if (this->params->shrinking)
00269                         return true;
00270                         
00271                 return false;
00272         }

virtual void damina::LearningEngine::learn ( DataSet  )  [pure virtual, inherited]

Implemented in damina::OneClassSVM, and damina::SVClustering.

virtual void damina::LearningEngine::learn (  )  [pure virtual, inherited]

Implemented in damina::OneClassSVM, and damina::SVClustering.

void damina::AbstractSVM::setCacheSize ( int  sizeMB  )  [virtual]

Set the kernel cache size.

The kernel cache is used to store the kernel values already computed

Parameters:
sizeMB The cache size im Megabytes

Definition at line 134 of file AbstractSVM.cpp.

References params.

Referenced by damina::SVClustering::SVClustering().

00134                                                  {
00135                 this->params->cache_size = sizeMB;
00136         }

Here is the caller graph for this function:

void damina::AbstractSVM::setKernel ( int  k,
int  degree,
double  width 
) [virtual]

Set the kernel type, the kernel degree and the kernel width for the SVM.

The values representing the Kernel Types are available in the KernelType class as public static attributes. The degree is only for the Polynomial Kernel. If you set a different type of Kernel with this method, the degree will be simply ignored. The gamma (width) parameter is ignored in case of Linear Kernel.

See also:
KernelType
Parameters:
k The integer value representing the Kernel Type
degree An integer value representing the degree in the Polynomial Kernel
width The kernel gamma, a real value in [0,1]

Definition at line 83 of file AbstractSVM.cpp.

References params.

00083                                                                    {
00084                 this->params->kernel_type = k;
00085                 this->params->degree = degree;
00086                 this->params->gamma = width;
00087         }

void damina::AbstractSVM::setKernel ( int  k,
double  width 
) [virtual]

Set both the kernel type and the kernel width (gamma) for the SVM.

The values representing the Kernel Types are available in the KernelType class as public static attributes. The gamma (width) parameter is ignored in case of Linear Kernel.

See also:
KernelType
Parameters:
k The integer value representing the Kernel Type
width The kernel gamma, a real value in [0,1]

Definition at line 46 of file AbstractSVM.cpp.

References params.

00046                                                        {
00047                 this->params->kernel_type = k;
00048                 this->params->gamma = width;
00049         }

void damina::AbstractSVM::setKernel ( int  k,
int  degree 
) [virtual]

Set both the kernel type and the kernel degree for the SVM.

The values representing the Kernel Types are available in the KernelType class as public static attributes. The degree is only for the Polynomial Kernel. If you set a different type of Kernel with this method, the degree will be simply ignored.

See also:
KernelType
Parameters:
k The integer value representing the Kernel Type
degree An integer value representing the degree in the Polynomial Kernel

Definition at line 63 of file AbstractSVM.cpp.

References params.

00063                                                      {
00064                 this->params->kernel_type = k;
00065                 this->params->degree = degree;
00066         }

void damina::AbstractSVM::setKernel ( int  k  )  [virtual]

Set the kernel type for the SVM.

The values representing the Kernel Types are available in the KernelType class as public static attributes.

See also:
KernelType
Parameters:
k The integer value representing the Kernel Type

Definition at line 31 of file AbstractSVM.cpp.

References params.

Referenced by damina::SVClustering::setKernelType(), and damina::SVClustering::SVClustering().

00031                                          {
00032                 this->params->kernel_type = k;
00033         }

Here is the caller graph for this function:

void damina::AbstractSVM::setKernelDegree ( int  deg  )  [virtual]

Set the kernel degree for the SVM.

The degree is only for the Polynomial Kernel. If you set a different type of Kernel, the degree will be simply ignored.

Parameters:
deg An integer value representing the degree in the Polynomial Kernel

Definition at line 106 of file AbstractSVM.cpp.

References params.

00106                                                  {
00107                 this->params->degree = deg;
00108         }

void damina::AbstractSVM::setKernelWidth ( double  w  )  [virtual]

Set the kernel width (gamma) for the SVM.

The gamma (width) parameter is ignored in case of Linear Kernel.

Parameters:
w The kernel gamma, a real value in [0,1]

Definition at line 95 of file AbstractSVM.cpp.

References params.

Referenced by damina::SVClustering::initialKernelWidth(), damina::SVClustering::setKernelWidth(), and damina::SVClustering::SVClustering().

00095                                                  {
00096                 this->params->gamma = w;
00097         }

Here is the caller graph for this function:

void damina::AbstractSVM::setTestSet ( DataSet test  )  [virtual]

Set the test set.

Parameters:
test The test set

Implements damina::LearningEngine.

Definition at line 143 of file AbstractSVM.cpp.

References testSet.

00143                                                   {
00144                 this->testSet = test;
00145         }

void damina::AbstractSVM::setTolerance ( double  t  )  [virtual]

Set the tolerance of termination criterion.

Pratically, the training of an SVM is always sub-optimal and a stop criterion is used to choose when the training algorithm will stop.

This method set the tolerance of the criterion used in the LibSVM.

Parameters:
t A real-valued parameter representing the tolerance of the termination criterion. Usually it assumes values between 0.001 and 0.00001

Definition at line 123 of file AbstractSVM.cpp.

References params.

Referenced by damina::SVClustering::SVClustering().

00123                                                {
00124                 this->params->eps = t;
00125         }

Here is the caller graph for this function:

void damina::AbstractSVM::setTrainingSet ( DataSet train  )  [virtual]

Set the training set.

Parameters:
train The training set

Implements damina::LearningEngine.

Reimplemented in damina::OneClassSVM.

Definition at line 152 of file AbstractSVM.cpp.

References trainingSet.

Referenced by damina::OneClassSVM::setTrainingSet().

00152                                                        {
00153                 this->trainingSet = train;
00154         }

Here is the caller graph for this function:


Member Data Documentation

struct svm_parameter* damina::AbstractSVM::params [read, protected]

The configuration parameters for set up an SVM using LibSVM.

Definition at line 36 of file AbstractSVM.h.

Referenced by disableShrinkingHeuristics(), enableShrinkingHeuristics(), getCacheSize(), getKernel(), getKernelDegree(), getKernelWidth(), damina::OneClassSVM::getNU(), getParameters(), getTolerance(), damina::OneClassSVM::OneClassSVM(), setCacheSize(), setKernel(), setKernelDegree(), setKernelWidth(), damina::OneClassSVM::setNU(), and setTolerance().

DataSet* damina::AbstractSVM::testSet [protected]

The test set.

Definition at line 26 of file AbstractSVM.h.

Referenced by AbstractSVM(), getTestSet(), setTestSet(), and ~AbstractSVM().

DataSet* damina::AbstractSVM::trainingSet [protected]

The training set.

Definition at line 31 of file AbstractSVM.h.

Referenced by getTrainingSet(), setTrainingSet(), and ~AbstractSVM().


The documentation for this class was generated from the following files:
Generated on Mon Sep 24 22:26:55 2007 for SVClustering by  doxygen 1.5.2