当前位置:
文档之家› 基于SVM的信息粒化时序回归预测——上证指数未来5天开盘指数变化趋势和变化空间预测
基于SVM的信息粒化时序回归预测——上证指数未来5天开盘指数变化趋势和变化空间预测
%%%127287877632.000%
%
%%%
%
%%%
%
%%
%%
0
(1990.12.19I2015.06.15)%
%%
/2 5990*6 double
,/
/0
%
%%6
0
,
,
,
, 7 , 7 .%
%%
%
data%=%csvread('data2.csv')%
[m,n]%=%size(data);%
%%
=%%g',bestmse,bestc,bestg);%
disp(str);%
%
%%
%
[bestmse,bestc,bestg]%=%SVMcgForRegress(r,tsx,I4,8,I10,10,3,0.5,0.5,0.05);%
%%
%%
%
disp('
');%
str%=%sprintf(%'SVM%parameters%for%R:Best%Cross%Validation%MSE%=%%g%Best%c%=%%g%Best%g%
sh_8_19=data(1:m,:);%
sh_open=data(1:m,1);%
%%
%ts%=%data(1:m,1);%
ts%=%sh_open;%
time%=%length(ts);%
%%
%% E 0
%
figure;%
plot(ts,'LineWidth',2);%
title('0
(1990.12.20I2015.06.15)','FontSize',12);%
xlabel('
','FontSize',12);%
ylabel('
','FontSize',12);%
grid%on;%
%%print%Idtiff%Ir600%lowresult;%
%%
figure;%
error%=%low_predict%I%Low';%
plot(error,'ro');%
title(' (predicted%dataIoriginal%data)','FontSize',12);%
xlabel('
','FontSize',12);%
ylabel('
','FontSize',12);%
grid%on;%
%%print%Idtiff%Ir600%lowresulterror;%
%%snapnow;%
%
%%%
SVM R
%
%%
%%
,R
/
%
%%mapminmax 4 matlab
%
[r,r_ps]%=%mapminmax(R);%
xlabel('7
(1990.12.19I2015.06.15)','FontSize',12);%
ylabel('
','FontSize',12);%
grid%on;%
%%print%Idtiff%Ir600%original;%
%%
snapnow;%
%
%%
%%%
%
%%
win_num%=%floor(time/5);%
%
low%=%low';%
snapnow;%
%
%%
3
SVM c&g%
%%
%
[bestmse,bestc,bestg]%=%SVMcgForRegress(low,tsx,I10,10,I10,10,3,1,1,0.1,1);%
% %%
%
%%
%
disp('
');%
str%=%sprintf(%'SVM%parameters%for%Low:Best%Cross%Validation%MSE%=%%g%Best%c%=%%g%Best%g%
%
%%% 5 R
%
figure;%
hold%on;%
plot(R,'b+');%
plot(r_predict,'r*');%
legend('original%r','predict%r',2);%
title('original%vs%predict','FontSize',12);%
grid%on;%
r_ps.ymin%=%100;%
r_ps.ymax%=%500;%
%% R
/%
[r,r_ps]%=%mapminmax(R,r_ps);%
%% E R /
%
figure;%
plot(r,'r*');%
title('r /
','FontSize',12);%
grid%on;%
%% R
,8 libsvm
20150610& 5,049.20& 5,164.16& 5,001.49& 5,106.04& -7.50& -0.15& 596,969,001.00& 1,005,432,283,129.00&
20150609& 5,145.98& 5,147.45& 5,042.96& 5,113.53& -18.35& -0.36& 729,893,818.00& 1,150,788,654,430.00&
=%%g',bestmse,bestc,bestg);%
disp(str);%
% %% SVM% cmd%=%['Ic%',%num2str(bestc),%'%Ig%',%num2str(bestg)%,%'%Is%3%Ip%0.1'];% r_model%=%svmtrain(r,%tsx,%cmd);% %% %% % [r_predict,r_mse]%=%svmpredict(r,tsx,low_model);% r_predict%=%mapminmax('reverse',r_predict,r_ps);% predict_r%=%svmpredict(1,win_num+1,r_model);% predict_r%=%mapminmax('reverse',predict_r,r_ps);% predict_r%
20150612& 5,143.34& 5,178.19& 5,103.40& 5,166.35& 44.76& 0.87& 625,627,854.00& 1,060,164,606,810.00&
20150611& 5,101.44& 5,122.46& 5,050.77& 5,121.59& 15.56& 0.30& 563,990,522.00& 974,670,611,914.00&
%
%%% 5 Low
%
figure;%
hold%on;%
plot(Low,'b+');%
plot(low_predict,'r*');%
legend('original%low','predict%low',2);%
title('original%vs%predict','FontSize',12);%
20150604& 4,912.95& 4,947.97& 4,647.41& 4,947.10& 37.12& 0.76& 674,952,402.00& 1,052,265,437,597.00&
%%
%
6
0
%
!
7
7 .%
2916.10000000000%%%%%%%%2929.06000000000%%%%%%%%2761.40000000000%%%%%%%%2785.58000000000%%%%%%%%140576800%%%%%
title('
','FontSize',12);%
xlabel('
','FontSize',12);%
ylabel('
','FontSize',12);%
grid%on;%
%%print%Idtiff%Ir600%FIGpic;%
%%
snapnow;%
%
%%%
SVM Low
%
%%
%%
, Low
/
%
plot(low,'b+');%
title('Low /
','FontSize',12);%
xlabel('
','FontSize',12);%