This content refers to the previous stable release of PyMVPA.
Please visit
www.pymvpa.org for the most
recent version of PyMVPA and its documentation.
clfs.libsvmc.svm
Module: clfs.libsvmc.svm
Inheritance diagram for mvpa.clfs.libsvmc.svm:
Wrap the libsvm package into a very simple class interface.
-
class mvpa.clfs.libsvmc.svm.SVM(kernel_type='linear', **kwargs)
Bases: mvpa.clfs._svmbase._SVM
Support Vector Machine Classifier.
This is a simple interface to the libSVM package.
Note
Available state variables:
- feature_ids: Feature IDS which were used for the actual training.
- predicting_time+: Time (in seconds) which took classifier to predict
- predictions+: Most recent set of predictions
- probabilities: Estimates of samples probabilities as provided by LibSVM
- trained_dataset: The dataset it has been trained on
- trained_labels+: Set of unique labels it has been trained on
- trained_nsamples+: Number of samples it has been trained on
- training_confusion: Confusion matrix of learning performance
- training_time+: Time (in seconds) which took classifier to train
- values+: Internal classifier values the most recent predictions are based on
(States enabled by default are listed with +)
See also
Please refer to the documentation of the base class for more information:
_SVM
Interface class to LIBSVM classifiers and regressions.
Default implementation (C/nu/epsilon SVM) is chosen depending
on the given parameters (C/nu/tube_epsilon).
SVM/SVR definition is dependent on specifying kernel, implementation
type, and parameters for each of them which vary depending on the
choices made.
Desired implementation is specified in svm_impl argument. Here
is the list if implementations known to this class, along with
specific to them parameters (described below among the rest of
parameters), and what tasks it is capable to deal with
(e.g. regression, binary and/or multiclass classification).
Implementations : |
|
- ONE_CLASS : one-class-SVM
Capabilities: oneclass
- C_SVC : C-SVM classification
Parameters: C
Capabilities: binary, multiclass
- NU_SVR : nu-SVM regression
Parameters: nu, tube_epsilon
Capabilities: regression
- NU_SVC : nu-SVM classification
Parameters: nu
Capabilities: binary, multiclass
- EPSILON_SVR : epsilon-SVM regression
Parameters: C, tube_epsilon
Capabilities: regression
|
Kernel choice is specified as a string argument kernel_type and it
can be specialized with additional arguments to this constructor
function. Some kernels might allow computation of per feature
sensitivity.
Kernels : |
- rbf
gamma
- linear : provides sensitivity
No parameters
- poly
coef0, degree, gamma
- sigmoid
coef0, gamma
|
Parameters: |
- tube_epsilon – Epsilon in epsilon-insensitive loss function of epsilon-SVM
regression (SVR). (Default: 0.01)
- C – Trade-off parameter between width of the margin and number of
support vectors. Higher C – more rigid margin SVM. In linear
kernel, negative values provide automatic scaling of their value
according to the norm of the data. (Default: -1.0)
- probability – Flag to signal either probability estimate is obtained within
LIBSVM. (Default: 0)
- degree – Degree of polynomial kernel. (Default: 3)
- shrinking – Either shrinking is to be conducted. (Default: 1)
- weight_label – To be used in conjunction with weight for custom per-label weight.
(Default: [])
- weight – Custom weights per label. (Default: [])
- epsilon – Tolerance of termination criteria. (For nu-SVM default is 0.001).
(Default: 5e-05)
- cache_size – Size of the kernel cache, specified in megabytes. (Default: 100)
- coef0 – Offset coefficient in polynomial and sigmoid kernels. (Default: 0.5)
- nu – Fraction of datapoints within the margin. (Default: 0.5)
- gamma – Scaling (width in RBF) within non-linear kernels. (Default: 0)
- enable_states (None or list of basestring) – Names of the state variables which should be enabled additionally
to default ones
- disable_states (None or list of basestring) – Names of the state variables which should be disabled
- kernel_type (basestr) – String must be a valid key for cls._KERNELS
|
-
model
Access to the SVM model.
-
summary()
Provide quick summary over the SVM classifier
-
untrain()
Untrain libsvm’s SVM: forget the model