为什么我从svmpredict获得一个空矩阵?

时间:2015-05-18 12:50:37

标签: svm matlab libsvm

我想从一个简单的时间序列中做出预测。观察y=[11,22,33,44,55,66,77,88,99,110]和时间x=[1,2,3,4,5,6,7,8,9,10]。我正在使用libsvm工具箱中的epsilon-SVR。我的代码如下:

x1 = (1:7)'; #' training set
y1 = [11, 22, 33, 44, 55, 66, 77]'; #' observations from time series
options = ' -s 3 -t 2 -c 100 -g 0.05 -p 0.0003 ';
model = svmtrain(y1, x1, options)
x2 = (8:10)'; #' test set
y2 = [88, 99, 110]'; #' hidden values that are not used for training
[y2_predicted, accuracy] = svmpredict(y2, x2, model)

svmpredict函数给出了null输出,如下所示:

y2_predicted =
     []
accuracy =
     []

1 个答案:

答案 0 :(得分:1)

您未获得输出预测的原因是您错误地调用了var seoFrame = document.getElementById('googleseo'); var elem = (seoFrame.contentDocument||seoFrame.contentWindow.document).documentElement; elem.getElementsByTagName('body')[0].scrollTop = 300; 。有两种方法可以调用它:

echo psc | tmadmin

输出一个参数和3,但不是2.所以要解决你的问题,你可以这样做:

svmpredict

如果您不关心决策值。如果你这样做,那么

[predicted_label, accuracy, decision_values/prob_estimates] = svmpredict(testing_label_vector, testing_instance_matrix, model, 'libsvm_options')
[predicted_label] = svmpredict(testing_label_vector, testing_instance_matrix, model, 'libsvm_options'