Package mvpa :: Package clfs :: Module _svmbase :: Class _SVM
[hide private]
[frames] | no frames]

Class _SVM

source code


Support Vector Machine Classifier.

Base class for all external SVM implementations.

Derived classes should define:

* _KERNELS: map(dict) should define assignment to a tuple containing
  implementation kernel type, list of parameters adherent to the
  kernel, and sensitivity analyzer e.g.::

  _KERNELS = {
         'linear': (shogun.Kernel.LinearKernel, (), LinearSVMWeights),
         'rbf' :   (shogun.Kernel.GaussianKernel, ('gamma',), None),
         ...
         }

Nested Classes [hide private]

Inherited from misc.state.Stateful: __metaclass__

Instance Methods [hide private]
 
__init__(self, kernel_type='linear', **kwargs)
Init base class of SVMs.
source code
 
__repr__(self)
Definition of the object summary over the object
source code
 
_getDefaultC(self, data)
Compute default C
source code
 
_getDefaultGamma(self, dataset)
Compute default Gamma
source code
 
getSensitivityAnalyzer(self, **kwargs)
Returns an appropriate SensitivityAnalyzer.
source code

Inherited from base.Classifier: __str__, isTrained, predict, regression, train, train2predict, trained, untrain

Inherited from misc.state.Stateful: __getattribute__, __setattr__, reset

Inherited from object: __delattr__, __hash__, __new__, __reduce__, __reduce_ex__

Class Variables [hide private]
  _ATTRIBUTE_COLLECTIONS = ['params', 'kernel_params']
  _SVM_PARAMS = {'C': Parameter(-1.0, descr= 'Trade-off paramete...
  _clf_internals = ['svm', 'kernel-based']
Describes some specifics about the classifier -- is that it is doing regression for instance....

Inherited from base.Classifier: feature_ids, predicting_time, predictions, retrainable, trained_dataset, trained_labels, training_confusion, training_time, values

Instance Variables [hide private]

Inherited from base.Classifier (private): _regression, _train2predict

Properties [hide private]

Inherited from misc.state.Stateful: descr

Inherited from object: __class__

Method Details [hide private]

__init__(self, kernel_type='linear', **kwargs)
(Constructor)

source code 

Init base class of SVMs. Not to be publicly used

TODO: handling of parameters might migrate to be generic for all classifiers. SVMs are choosen to be testbase for that functionality to see how well it would fit.

Parameters:
  • kernel_type (basestr) - String must be a valid key for cls._KERNELS
Overrides: object.__init__

__repr__(self)
(Representation operator)

source code 
Definition of the object summary over the object
Overrides: object.__repr__

_getDefaultC(self, data)

source code 

Compute default C

TODO: for non-linear SVMs

_getDefaultGamma(self, dataset)

source code 

Compute default Gamma

TODO: unify bloody libsvm interface so it makes use of this function. Now it is computed within SVMModel.__init__

getSensitivityAnalyzer(self, **kwargs)

source code 
Returns an appropriate SensitivityAnalyzer.
Overrides: base.Classifier.getSensitivityAnalyzer

Class Variable Details [hide private]

_SVM_PARAMS

Value:
{'C': Parameter(-1.0, descr= 'Trade-off parameter. High C -- rigid mar\
gin SVM'), 'nu': Parameter(0.5, min= 0.0, max= 1.0, descr= 'Fraction o\
f datapoints within the margin'), 'cache_size': Parameter(100, descr= \
'Size of the kernel cache, specified in megabytes'), 'coef0': Paramete\
r(0.5, descr= 'Offset coefficient in polynomial and sigmoid kernels'),\
 'degree': Parameter(3, descr= 'Degree of polynomial kernel'), 'tube_e\
psilon': Parameter(0.1, descr= 'Epsilon in epsilon-insensitive loss fu\
nction of epsilon-SVM regression (SVR)'), 'gamma': Parameter(0, descr=\
...