Package mvpa :: Package clfs :: Package libsvmc :: Module _svm :: Class SVMModel
[hide private]
[frames] | no frames]

Class SVMModel

source code

Instance Methods [hide private]
 
__init__(self, arg1, arg2=None) source code
 
__repr__(self)
Print string representation of the model or easier comprehension and some statistics
source code
 
predict(self, x) source code
 
getNRClass(self) source code
 
getLabels(self) source code
 
predictValuesRaw(self, x) source code
 
predictValues(self, x) source code
 
predictProbability(self, x) source code
 
getSVRProbability(self) source code
 
getSVRPdf(self) source code
 
save(self, filename) source code
 
__del__(self) source code
 
getTotalNSV(self) source code
 
getNSV(self)
Returns a list with the number of support vectors per class.
source code
 
getSV(self)
Returns an array with the all support vectors.
source code
 
getSVCoef(self)
Return coefficients for SVs... Needs to be used directly with caution!
source code
 
getRho(self)
Return constant(s) in decision function(s) (if multi-class)
source code
Method Details [hide private]

getSV(self)

source code 

Returns an array with the all support vectors.

array( nSV x <nFeatures>)

getSVCoef(self)

source code 

Return coefficients for SVs... Needs to be used directly with caution!

Summary on what is happening in libsvm internals with sv_coef

svm_model's sv_coef (especially) are "cleverly" packed into a matrix nr_class - 1 x #SVs_total which stores coefficients for nr_class x (nr_class-1) / 2 binary classifiers' SV coefficients.

For classifier i-vs-j General packing rule can be described as:

i-th row contains sv_coefficients for SVs of class i it took in all i-vs-j or j-vs-i classifiers.

Another useful excerpt from svm.cpp is

// classifier (i,j): coefficients with // i are in sv_coef[j-1][nz_start[i]...], // j are in sv_coef[i][nz_start[j]...]

It can also be described as j-th column lists coefficients for SV # j which belongs to some class C, which it took (if it was an SV, ie != 0) in classifiers i vs C (iff i<C), or C vs i+1 (iff i>C)

This way no byte of storage is wasted but imho such setup is quite convolved