利用libsvm跑svm多分类, svm_train函数总报错?
importsysimportospath='/Library/Frameworks/Python.framework/Versions/3.7/lib/python3....
import sys
import os
path = '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/libsvm'
sys.path.append(path)
from svmutil import *
data=svm_read_problem('/Users/happysheep224/documents/matlab/libsvm-weights-3.24/heart_scale');
m = svm_train(data,'-c 4 -g 0.7 -v 10');
p_label,p_acc,p_val=svm_predict(y,x,m);
我这段代码就是运行不通过,报错:
m = svm_train(data,'-c 4 -g 0.7 -v 10');
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/libsvm/svmutil.py", line 91, in svm_train
assert isinstance(arg2, (list, tuple)) or (scipy and isinstance(arg2, scipy.ndarray))
AssertionError 展开
import os
path = '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/libsvm'
sys.path.append(path)
from svmutil import *
data=svm_read_problem('/Users/happysheep224/documents/matlab/libsvm-weights-3.24/heart_scale');
m = svm_train(data,'-c 4 -g 0.7 -v 10');
p_label,p_acc,p_val=svm_predict(y,x,m);
我这段代码就是运行不通过,报错:
m = svm_train(data,'-c 4 -g 0.7 -v 10');
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/libsvm/svmutil.py", line 91, in svm_train
assert isinstance(arg2, (list, tuple)) or (scipy and isinstance(arg2, scipy.ndarray))
AssertionError 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询