0
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_採取只有一個參數...如何解決?