2012-07-07 37 views
0

我叫錯誤LIBSVM Python接口

model = svm_model(svm_problem(prob_y, prob_x), svm_param) 

但我得到的錯誤:

Traceback (most recent call last): 
    File "./multiprob.py", line 267, in <module> 
    main() 
    File "./multiprob.py", line 226, in main 
    train_x, train_y, test_x, test_y, param, outfile) 
    File "./multiprob.py", line 89, in testing 
    model[i,j]=base_train(cls_x[i], cls_x[j], param) 
    File "/data/svm/svmprob-1.2/svmPlatt.py", line 15, in SvmPlattTrain 
    model = svm_model(svm_problem(prob_y, prob_x), svm_param) 
TypeError: __init__() takes exactly 1 argument (3 given) 

我查看/usr/lib64/python2.6/site-packages/libsvm/代碼svm.py

class svm_model(Structure): 
>---_names = ['param', 'nr_class', 'l', 'SV', 'sv_coef', 'rho', 
>--->--->---'probA', 'probB', 'label', 'nSV', 'free_sv'] 
>---_types = [svm_parameter, c_int, c_int, POINTER(POINTER(svm_node)), 
>--->--->---POINTER(POINTER(c_double)), POINTER(c_double), 
>--->--->---POINTER(c_double), POINTER(c_double), POINTER(c_int), 
>--->--->---POINTER(c_int), c_int] 
>---_fields_ = genFields(_names, _types) 

>---def __init__(self): 
>--->---self.__createfrom__ = 'python' 

init_採取只有一個參數...如何解決?

回答

0

這是針對libSVM的版本錯誤。 libSVM 3.x更改了libSVM 2.8.9中使用的模型。