Why I select the SVMR because It has shown its great advantage in small sample learning and do not require stationary process. However, I have trouble doing support vector regression for a month. Even though, I have done smoothing (monthly to quarter) for outlier reduction but I still suffered from outlier. The training process seem to be normality but when I used the unseen data for testing the model the result is not work. As you can see in the figure, the forecasted output have shifted down from the actual line. Is there anyone can suggest what happen with my model?
Regards, W. Amontep
- Model : Support Vector Regression (kernel : RBF)
- Data type : Time series of Stock index (43 quarter)
- Pre-processing data : Dimension reduction using PCA
- Number of Training : 39
- Number of testing : 4
New_selected = zscore(New_selected);
SET = zscore(SET);
mm = mean(New_selected(1:39,:));
NumOfPC = 3;
[COEFF,SCORE,latent] = pca(New_selected(1:39,:)); %PCA
Ro_COEFF = rotatefactors(COEFF(:,1:3));
ro_pca = gen_pca(New_selected(1:39,:),Ro_COEFF,mm,NumOfPC);
svmdl = fitrsvm(ro_pca(:,1:3), SET(1:39),'KernelFunction','rbf','KernelScale','auto');
unseen_data = New_selected(40:43,:);
unseen_pca = gen_pca(unseen_data, Ro_COEFF,mm,NumOfPC);
cont_pc = [ro_pca; unseen_pca];
trainOutput = predict(svmdl,ro_pca(:,1:3));
testOutput = predict(svmdl,unseen_pca(:,1:3));
con = [trainOutput; testOutput];
figure, hold on
plot(SET,'-+r');
plot(con,'-og');
% figure, hold on
% plot(SET(1:39),'-+r');
% plot(trainOutput,'-og');
rmse = @(y,yh)(sum((y(:)-yh(:)).^2 / numel(y)));
fprintf ('Root Mean Square Error(RMSE).\n');
rmse(SET(40:43),testOutput)