简体   繁体   English

在Matlab中使用LIBSVM执行回归

[英]Performing regression using LIBSVM in Matlab

I am working on multivariate time series estimation. 我正在研究多元时间序列估计。 I am not quite sure if LIBSVM does that. 我不太确定LIBSVM是否会这样做。 How can I solve the basic univariate linear problem? 如何解决基本的单变量线性问题?

Suppose I have x = [1990,1991,1992,1993,1994] and y = [1,2,3,4,5]. 假设我有x = [1990,1991,1992,1993,1994]和y = [1,2,3,4,5]。 Now I would like to predict the value at testx = 1995 using LIBSVM in Matlab. 现在,我想在Matlab中使用LIBSVM预测testx = 1995的值。 I tried using the toolbox but the results I got is 我尝试使用工具箱,但得到的结果是

model = svmtrain(y,x,'-s 3 -t 0 -c 1 -p 0.1');
*
optimization finished, #iter = 0
nu = 0.000000
obj = 0.000000, rho = -1.000000
nSV = 0, nBSV = 0
>> TST = 6;
[predicted_label, accuracy, prob_estimates]=svmpredict(TST,testx,model);
Mean squared error = 25 (regression)
Squared correlation coefficient = -1.#IND (regression) 

What is going on here? 这里发生了什么? As the data I gave is linear I have chosen -t 0 which is linear kernel. 正如我给的数据是线性的我所选择-t 0其是直链的内核。

I finally figured out what's wrong. 我终于发现了什么问题。 The input I am passing through is a row vector. 我通过的输入是行向量。 Libsvm takes an input in a column vector format. Libsvm采用列向量格式的输入。 x should be m*n where m is the number of data and n is the number of features and y is a column label vector. x应该是m * n,其中m是数据数,n是要素数,y是列标签向量。 Thanks to Sriram who helped me solve the problem. 感谢Sriram帮助我解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM