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_采用一个参数...如何解决?

4

1 回答 1

0

这是针对 libSVM 的版本错误。libSVM 3.x 更改了 libSVM 2.8.9 中使用的模型。

于 2012-08-22T18:18:19.507 回答