在R中的SVM中获得重复结果

时间:2018-07-02 10:37:52

标签: r svm

我正在尝试使用R软件包“ e1071”中的SVM进行预测。但是我得到了重复的值作为预测结果。我已经运行了几次,但是得到了相同的结果。请帮助我找出问题所在。

library(e1071)
tuneResult <- tune(svm,y~.,data=calibration.data,ranges = list(epsilon = seq(0,1,0.1), cost = 2^(2:9)))
tunedModel <- tuneResult$best.model
predict.data<-predict(tunedModel,prediction.data)
predict.data


2006-03-01 2006-04-01 2006-05-01 2006-06-01 2006-07-01 2006-08-01 2006-09-01 2006-10-01 2006-11-01 2006-12-01 2007-01-01 2007-02-01 2007-03-01 2007-04-01 2007-05-01 
0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 
2007-06-01 2007-07-01 2007-08-01 2007-09-01 2007-10-01 2007-11-01 2007-12-01 2008-01-01 2008-02-01 2008-03-01 2008-04-01 2008-05-01 2008-06-01 2008-07-01 2008-08-01 
0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 
2008-09-01 2008-10-01 2008-11-01 2008-12-01 2009-01-01 2009-02-01 2009-03-01 2009-04-01 2009-05-01 2009-06-01 2009-07-01 2009-08-01 2009-09-01 2009-10-01 2009-11-01 
0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 0.05798676 

.....and so on.

校准数据采用以下格式:

                  y      X1      X2      X3      X4      X5      X6      X7      X8      X9     X10     X11     X12
1991-03-01  -8.5371 -0.4166 -0.1033 -0.2974  0.0130 -3.7858 -3.6329 -4.0668 -3.9070 -5.6851 -5.7326 -6.2762 -6.3069
1991-04-01  -8.4224  2.2427  2.6264  2.5721  2.9529 -0.4166 -0.1033 -0.2974  0.0130 -3.7858 -3.6329 -4.0668 -3.9070
1991-05-01  -8.1701  4.0619  4.4961  4.4715  4.9228  2.2427  2.6264  2.5721  2.9529 -0.4166 -0.1033 -0.2974  0.0130
1991-06-01  -8.5097  3.6112  3.6158  4.0910  4.0928  4.0619  4.4961  4.4715  4.9228  2.2427  2.6264  2.5721  2.9529
1991-07-01  -8.5450  0.8204  0.6754  1.1004  0.9026  3.6112  3.6158  4.0910  4.0928  4.0619  4.4961  4.4715  4.9228
1991-08-01  -4.3212  0.2197  0.1151  0.2999  0.1626  0.8204  0.6754  1.1004  0.9026  3.6112  3.6158  4.0910  4.0928
1991-09-01   1.0677  0.8090  0.8248  0.8393  0.8325  0.2197  0.1151  0.2999  0.1626  0.8204  0.6754  1.1004  0.9026
1991-10-01   2.4652  1.1682  1.0744  1.0487  0.9724  0.8090  0.8248  0.8393  0.8325  0.2197  0.1151  0.2999  0.1626
1991-11-01  -1.5196 -0.4426 -0.7859 -0.8218 -1.1477  1.1682  1.0744  1.0487  0.9724  0.8090  0.8248  0.8393  0.8325
1991-12-01  -6.7485 -3.8733 -4.2662 -4.3024 -4.6878 -0.4426 -0.7859 -0.8218 -1.1477  1.1682  1.0744  1.0487  0.9724
1992-01-01  -7.8150 -4.9241 -4.9465 -5.5029 -5.5178 -3.8733 -4.2662 -4.3024 -4.6878 -0.4426 -0.7859 -0.8218 -1.1477
1992-02-01  -5.7313 -4.4448 -4.4869 -4.7235 -4.7979 -4.9241 -4.9465 -5.5029 -5.5178 -3.8733 -4.2662 -4.3024 -4.6878
1992-03-01  -0.9963 -0.6056 -0.2872 -0.5941 -0.2780 -4.4448 -4.4869 -4.7235 -4.7979 -4.9241 -4.9465 -5.5029 -5.5178
....................
2005-11-01  -4.2856 -1.8385 -2.3010 -2.0255 -2.5012  0.8122  0.5494  0.8150  0.5389  0.2630  0.2697  0.3856  0.3990
2005-12-01  -6.3069 -4.8993 -5.1313 -5.4161 -5.6413 -1.8385 -2.3010 -2.0255 -2.5012  0.8122  0.5494  0.8150  0.5389

预测数据为:

             X1       X2       X3       X4       X5       X6       X7       X8       X9      X10      X11      X12
2006-03-01 25.47954 25.12117 25.32201 25.01688 21.95794 21.53203 21.73904 21.41161 19.60088 19.29948 19.04211 18.89265
2006-04-01 30.07153 30.01922 30.53638 30.34532 25.47954 25.12117 25.32201 25.01688 21.95794 21.53203 21.73904 21.41161
2006-05-01 32.17442 32.34361 33.43570 33.57129 30.07153 30.01922 30.53638 30.34532 25.47954 25.12117 25.32201 25.01688
2006-06-01 28.61485 28.59253 29.06019 29.09922 32.17442 32.34361 33.43570 33.57129 30.07153 30.01922 30.53638 30.34532
2006-07-01 28.13924 27.78606 28.53410 28.16312 28.61485 28.59253 29.06019 29.09922 32.17442 32.34361 33.43570 33.57129

请帮助我找出解决方案。

0 个答案:

没有答案