Package mvpa :: Package clfs :: Package sg :: Module svm :: Class SVM
[hide private]
[frames] | no frames]

Class SVM

source code


Support Vector Machine Classifier(s) based on Shogun

This is a simple base interface

Nested Classes [hide private]

Inherited from misc.state.ClassWithCollections: __metaclass__

Instance Methods [hide private]
 
__init__(self, kernel_type='linear', **kwargs)
This is the base class of all classifier that utilize so far just SVM classifiers provided by shogun.
source code
 
__condition_kernel(self, kernel) source code
 
_train(self, dataset)
Train SVM
source code
 
_predict(self, data)
Predict values for the data
source code
 
untrain(self)
Reset trained state
source code
 
__get_implementation(self, ul) source code

Inherited from _svmbase._SVM: __repr__, getSensitivityAnalyzer

Inherited from _svmbase._SVM (private): _getDefaultC, _getDefaultGamma

Inherited from base.Classifier: __str__, isTrained, predict, repredict, retrain, summary, train, trained

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

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

Class Variables [hide private]
  num_threads = Parameter(1, min= 1, descr= 'Number of threads t...
  _KERNELS = {"linear":(shogun.Kernel.LinearKernel, ('scale',), ...
  _KNOWN_PARAMS = ['epsilon']
  _KNOWN_KERNEL_PARAMS = []
  _clf_internals = _SVM._clf_internals+ ['sg', 'retrainable']
Describes some specifics about the classifier -- is that it is doing regression for instance....
  _KNOWN_IMPLEMENTATIONS = {"libsvm":(shogun.Classifier.LibSVM, ...
  svm = property(fget= lambda self: self.__svm)
Access to the SVM model.
  traindataset = property(fget= lambda self: self.__traindataset)
Dataset which was used for training

Inherited from _svmbase._SVM (private): _ATTRIBUTE_COLLECTIONS, _SVM_PARAMS

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

Inherited from misc.state.ClassWithCollections: descr

Instance Variables [hide private]
  __svm
Holds the trained svm.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

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

source code 

This is the base class of all classifier that utilize so far just SVM classifiers provided by shogun.

TODO Documentation if this all works ;-)

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

_train(self, dataset)

source code 
Train SVM
Overrides: base.Classifier._train

_predict(self, data)

source code 
Predict values for the data
Overrides: base.Classifier._predict

untrain(self)

source code 
Reset trained state
Overrides: base.Classifier.untrain
(inherited documentation)

Class Variable Details [hide private]

num_threads

Value:
Parameter(1, min= 1, descr= 'Number of threads to utilize')

_KERNELS

Value:
{"linear":(shogun.Kernel.LinearKernel, ('scale',), LinearSVMWeights), \
"rbf":(shogun.Kernel.GaussianKernel, ('gamma',), None), "rbfshift":(sh\
ogun.Kernel.GaussianShiftKernel, ('gamma', 'max_shift', 'shift_step'),\
 None), "sigmoid":(shogun.Kernel.SigmoidKernel, ('cache_size', 'gamma'\
, 'coef0'), None),}

_KNOWN_IMPLEMENTATIONS

Value:
{"libsvm":(shogun.Classifier.LibSVM, ('C',), ('multiclass', 'binary'),\
 ''), "gmnp":(shogun.Classifier.GMNPSVM, ('C',), ('multiclass', 'binar\
y'), ''), "gpbt":(shogun.Classifier.GPBTSVM, ('C',), ('binary',), ''),\
 "gnpp":(shogun.Classifier.GNPPSVM, ('C',), ('binary',), ''), "libsvr"\
:(shogun.Regression.LibSVR, ('C', 'tube_epsilon',), ('regression',), '\
'), "krr":(shogun.Regression.KRR, ('tau',), ('regression',), ''),}

traindataset

Dataset which was used for training

TODO -- might better become state variable I guess

Value:
property(fget= lambda self: self.__traindataset)