Error using Regression​SVM.prepar​eData. anybody can help me

1 次查看(过去 30 天)
Here I give my coding and i have error on this:
Error in newavelet (line 49) mdl = fitrsvm(xt,yt,'KernelFunction','linear','KernelScale','auto');
close all; clear variables; clc;
DT=xlsread('imf9'); N=length(DT); input_lag=2;%no. of input IN=input_lag; dt=log(DT);
%matrix lag yg digunakan utk regression XLAG = lagmatrix(dt,[0:IN]); %change matrix if input_lag change N1=length(XLAG)-IN; %length utk panjang N without NA observation F=61; %No. of forecast N2=N1-F; %No. of training
%training - use (IN+1) due to after lagmatrix N/A data for no. of inputs xt=XLAG(IN+1:N-F,2:IN+1); yt=XLAG(IN+1:N-F,1);
%validation - use (N_ORI-1) due to after log return data reduce 1 xv=XLAG(N-F+1:N,2:IN+1); yv=XLAG(N-F+1:N,1);
%original data for calculating error ytOri=DT(IN+1:N-F);%training data yvOri=DT(N-F+1:N);%validation data
%define matrix utk regression a=ones(N2,1);%training data b=ones(F,1);%validation data X=[a xt];%training data x=[b xv];%validation data
d1='db2'; Dc=3;%wavelet decomposition level
[w, w1]=waveletdwt(IN,Dc,d1,xt,xv); Z=[a w];%wavelet data utk training Z1=[b w1];%wavelet data utk validation
%xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx % SVM %xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
mdl = fitrsvm(xt,yt,'KernelFunction','linear','KernelScale','auto'); yts = predict(mdl,xt); yvs = predict(mdl,xv);
%transform log tourism data to tourism data transformYts=exp(yts); transformYvs=exp(yvs);
YTS=transformYts; YVS=transformYvs; M1(1)=sqrt(mse(YTS-ytOri)); M1(2)=sqrt(mse(YVS-yvOri)); M1(3)=mae(YTS-ytOri); M1(4)=mae(YVS-yvOri); M1(5)=corr(YTS,ytOri); M1(6)=corr(YVS,yvOri); %M11(5)=1-sum((y1-yt).^2)/sum((y1-mean(y1)).^2); %M11(6)=1-sum((pd2-fr).^2)/sum((fr-mean(fr)).^2);
%xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx % Wavelet-SVM %xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
wmdl = fitrsvm(Z,yt,'KernelFunction','linear','KernelScale','auto'); Wyts = predict(wmdl,Z); Wyvs = predict(wmdl,Z1);
%transform log tourism data to tourism data WYTS=exp(Wyts); WYVS=exp(Wyvs);
M11(1)=sqrt(mse(WYTS-ytOri));
M11(2)=sqrt(mse(WYVS-yvOri));
M11(3)=mae(WYTS-ytOri);
M11(4)=mae(WYVS-yvOri);
M11(5)=corr(WYTS,ytOri);
M11(6)=corr(WYVS,yvOri);
%M11(5)=1-sum((y1-yt).^2)/sum((y1-mean(y1)).^2);
%M11(6)=1-sum((pd2-fr).^2)/sum((fr-mean(fr)).^2);
%xxxxxxxxxxxxxxxxxxxxxxxxxxx % result & plot graph %xxxxxxxxxxxxxxxxxxxxxxxxxxx
digits(4) SVMR=sym(M1,'d') WSVMR=sym(M11,'d') g1=1:F; plot(g1,yvOri,'r',g1,WYVS,'g') % plot original data vs result from wavelet svm

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Regression 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by