bob.trainer.SVMTrainer

class bob.trainer.SVMTrainer((object)self[, (svm_type)svm_type=bob.machine._machine.svm_type.C_SVC[, (svm_kernel_type)kernel_type=bob.machine._machine.svm_kernel_type.RBF[, (int)degree=3[, (float)gamma=0.0[, (float)coef0=0.0[, (float)cache_size=100[, (float)eps=0.001[, (float)cost=1.0[, (float)nu=0.5[, (float)p=0.1[, (bool)shrinking=True[, (bool)probability=False]]]]]]]]]]]]) → None :

Bases: Boost.Python.instance

This class emulates the behavior of the command line utility called svm-train, from libsvm. These bindings do not support:

  • Precomputed Kernels
  • Regression Problems
  • Different weights for every label (-wi option in svm-train)

Fell free to implement those and remove these remarks.

Builds a new trainer setting the default parameters as defined in the command line application svm-train.

__init__((object)self[, (svm_type)svm_type=bob.machine._machine.svm_type.C_SVC[, (svm_kernel_type)kernel_type=bob.machine._machine.svm_kernel_type.RBF[, (int)degree=3[, (float)gamma=0.0[, (float)coef0=0.0[, (float)cache_size=100[, (float)eps=0.001[, (float)cost=1.0[, (float)nu=0.5[, (float)p=0.1[, (bool)shrinking=True[, (bool)probability=False]]]]]]]]]]]]) → None :

Builds a new trainer setting the default parameters as defined in the command line application svm-train.

Methods

__init__((object)self [, …) Builds a new trainer setting the default parameters as defined in the command line application svm-train.
train((SVMTrainer)self, (object)data) Trains a new machine for multi-class classification.

Attributes

cache_size libsvm cache size in Mb
coef0 Coefficient 0 for poly/sigmoid
cost The cost for C_SVC, EPSILON_SVR and NU_SVR
degree Polynomial degree
eps The epsilon used for stop training
gamma Gamma parameter for poly/rbf/sigmoid
kernel_type SVM kernel type to use
nu for NU_SVC, ONE_CLASS and NU_SVR
p for EPSILON_SVR, this is the ‘epsilon’ value on the equation
probability do probability estimates
shrinking use the shrinking heuristics
svm_type Type of SVM to train
cache_size

libsvm cache size in Mb

coef0

Coefficient 0 for poly/sigmoid

cost

The cost for C_SVC, EPSILON_SVR and NU_SVR

degree

Polynomial degree

eps

The epsilon used for stop training

gamma

Gamma parameter for poly/rbf/sigmoid

kernel_type

SVM kernel type to use

nu

for NU_SVC, ONE_CLASS and NU_SVR

p

for EPSILON_SVR, this is the ‘epsilon’ value on the equation

probability

do probability estimates

shrinking

use the shrinking heuristics

svm_type

Type of SVM to train

train((SVMTrainer)self, (object)data) → SupportVector :

Trains a new machine for multi-class classification. If the number of classes in data is 2, then the assigned labels will be -1 and +1. If the number of classes is greater than 2, labels are picked starting from 1 (i.e., 1, 2, 3, 4, etc.). If what you want is regression, the size of the input data array should be 1.

train( (SVMTrainer)self, (object)data, (object)subtract, (object)divide) -> SupportVector :
This version accepts scaling parameters that will be applied column-wise to the input data.