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)
Interface class to Shogun's classifiers and regressions.
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__, clone, isTrained, predict, repredict, retrain, summary, train, trained

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

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

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

Class Methods [hide private]

Inherited from _svmbase._SVM (private): _customizeDoc

Class Variables [hide private]
  num_threads = Parameter(1, min= 1, doc= 'Number of threads to ...
  _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, trained_nsamples, training_confusion, training_time, values

Inherited from misc.state.ClassWithCollections: descr

Instance Variables [hide private]
  __svm
Holds the trained svm.
  __svm_apply
Compatibility convenience to bind to the classify/apply method of __svm
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

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

source code 

Interface class to Shogun's classifiers and regressions.

Default implementation is 'libsvm'.

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, doc= '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'),\
 "LIBSVM's C-SVM (L2 soft-margin SVM)"), "gmnp":(shogun.Classifier.GMN\
PSVM, ('C',), ('multiclass', 'binary'), "Generalized Nearest Point Pro\
blem SVM"), "gpbt":(shogun.Classifier.GPBTSVM, ('C',), ('binary',), "G\
radient Projection Decomposition Technique for " "large-scale SVM prob\
lems"), "gnpp":(shogun.Classifier.GNPPSVM, ('C',), ('binary',), "Gener\
alized Nearest Point Problem SVM"), "libsvr":(shogun.Regression.LibSVR\
, ('C', 'tube_epsilon',), ('regression',), "LIBSVM's epsilon-SVR"),}

traindataset

Dataset which was used for training

TODO -- might better become state variable I guess

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