为什么LIBSVM中的svmpredict返回空预测和准确性?

时间:2016-09-23 12:24:28

标签: matlab libsvm

所以我的代码是

% using LIBSVM   '-t 0' means linear '-c 0.1' means C = 0.1
model = svmtrain(y, X , '-t 0 -c 0.1');

% using LIBSVM 
[p, accuracy] = svmpredict(y, X, model);

但是我得到“p”和“准确”变量的空结果。

我在堆栈交换中看到了this问题,但这并没有回答我的问题。

修改

所以问题在this问题中解决了。

但我仍然不明白为什么matlab命令

[p, accuracy] = svmpredict(y, X, model);

是inccorect。因为我甚至用一个简单的函数测试了我自己,我知道在matlab中我们的函数让我们说“fun”会返回两个值,如

function [ minus , plus ] = fun( a , b )

  minus = a-b;

  plus = a+b;

end

现在如果我将此功能用作

[m ] = fun(1,2)

matlab将回答-1。而不是像“svmtrain”那样返回一个空答案。

为什么会这样?

0 个答案:

没有答案
相关问题