I want to subclass the LibSvm object class exported from the mlpy machine learning package:
from mlpy import MaximumLikelihoodC, LibSvm
class Svm(LibSvm):
def __init__(self,Gs,ls):
self._K = ls.shape[1]
self._Gs = Gs
self._N = Gs.shape[1]
self._ls = ls
LibSvm.__init__('c_svc','rbf',\
gamma=1.0/self._N,C=100,probability=True)
When I call the constructor, e.g.,
svm = Svm(Gs,ls)
the interpreter ignores my init and executers the init method of LibSvm, giving an error
svm = SVM(Gs,ls)
File "libsvm.pyx", line 146, in mlpy.libsvm.LibSvm.__cinit__ mlpy/libsvm/libsvm.c:1803)
ValueError: invalid svm_type
I have no problem subclassing MaximumLikelihoodC using the same syntax.