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.

Nested Classes | [hide private]

Inherited from `misc.state.ClassWithCollections`: `__metaclass__`

Instance Methods | [hide private]

__init__(self, kernel_type='linear', **kwargs) Init base class of SVMs. Not to be publicly used | 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__`, `clone`, `isTrained`, `predict`, `repredict`, `retrain`, `summary`, `train`, `trained`, `untrain`

Inherited from `base.Classifier` (private): `_getFeatureIds`, `_postpredict`, `_posttrain`, `_predict`, `_prepredict`, `_pretrain`, `_regressionIsBogus`, `_setRetrainable`, `_train`

Inherited from `misc.state.ClassWithCollections`: `__getattribute__`, `__new__`, `__setattr__`, `reset`

Inherited from `object`: `__delattr__`, `__format__`, `__hash__`, `__reduce__`, `__reduce_ex__`, `__sizeof__`, `__subclasshook__`

Class Methods | [hide private]

_customizeDoc(cls) | source code

Class Variables | [hide private]

| _ATTRIBUTE_COLLECTIONS = `['params', 'kernel_params']`
| _SVM_PARAMS = `{'C': Parameter(-1.0, doc= 'Trade-off parameter `...``
| _clf_internals = `['svm', 'kernel-based']` Describes some specifics about the classifier -- is that it is doing regression for instance....
Inherited from `base.Classifier`: `_DEV__doc__`, `feature_ids`, `predicting_time`, `predictions`, `regression`, `retrainable`, `trained_dataset`, `trained_labels`, `trained_nsamples`, `training_confusion`, `training_time`, `values` Inherited from `misc.state.ClassWithCollections`: `descr`

Properties | [hide private]

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 chosen 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

Parameters:
  - `fullname` - Either to include full name of the module
  - `prefixes` - What other prefixes to prepend to list of arguments
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, doc= 'Trade-off parameter between width of the '
       'margin and number of support vectors. Higher C -- ' 'more rigid marg
      in SVM. In linear kernel, negative ' 'values provide automatic scaling
       of their value ' 'according to the norm of the data'), 'nu': Paramete
      r(0.5, min= 0.0, max= 1.0, doc= 'Fraction of datapoints within the mar
      gin'), 'cache_size': Parameter(100, doc= 'Size of the kernel cache, sp
      ecified in megabytes'), 'coef0': Parameter(0.5, doc= 'Offset coefficie
      nt in polynomial and sigmoid kernels'), 'degree': Parameter(3, doc= 'D
      ...