how can i predict one week later(multistep prediction), this code just predicts one step in the future please make my code right(it's about wind speed prediction with 3 input parameter(pressure, humidity, temperature) and one target(wind speed)
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Morteza Hajitabar Firuzjaei
am 24 Jan. 2018
Beantwortet: Greg Heath
am 25 Jan. 2018
load('input.mat'); Input_Parameter = tonndata(inputData(:,(1:3)),false,false);
Target_Parameter = tonndata(inputData(:,1),false,false);
inputSeries = Input_Parameter; targetSeries = Target_Parameter;
inputDelays = 1:4; feedbackDelays = 1:4; hiddenLayerSize = 10; net = narxnet(inputDelays,feedbackDelays,hiddenLayerSize);
% Prepare the Data for Training and Simulation % The function PREPARETS prepares time series data % for a particular network, shifting time by the minimum % amount to fill input states and layer states. % Using PREPARETS allows you to keep your original % time series data unchanged, while easily customizing it % for networks with differing numbers of delays, with % open loop or closed loop feedback modes. [inputs,inputStates,layerStates,targets] = preparets(net,inputSeries,{},targetSeries);
% Set up Division of Data for Training, Validation, Testing net.divideParam.trainRatio = 70/100; net.divideParam.valRatio = 15/100; net.divideParam.testRatio = 15/100;
% Train the Network [net,tr] = train(net,inputs,targets,inputStates,layerStates);
% Test the Network outputs = net(inputs,inputStates,layerStates); errors = gsubtract(targets,outputs); performance = perform(net,targets,outputs);
% View the Network view(net) %------------------------------------------------ outputs = cell2mat(outputs); N=length(outputs); figure(1), hold on plot( 1:N, outputs, 'LineWidth', 2) plot( 1:N, outputs, 'ro', 'LineWidth', 2) legend( ' TARGET ', ' OUTPUT ' ) title( ' NARXNET EXAMPLE ' ) %--------------------------------------------------
netc = closeloop(net); netc.name = [net.name ' - Closed Loop']; view(netc) [xc,xic,aic,tc] = preparets(netc,inputSeries,{},targetSeries); yc = netc(xc,xic,aic); perfc = perform(netc,tc,yc);
nets = removedelay(net); nets.name = [net.name ' - Predict One Step Ahead']; view(nets) [xs,xis,ais,ts] = preparets(nets,inputSeries,{},targetSeries); ys = nets(xs,xis,ais); earlyPredictPerformance = perform(nets,ts,ys);
ys = cell2mat(ys); M=length(ys); figure(1), hold on plot( 1:M, ys, 'LineWidth', 1) plot( 1:M, ys, 'ro', 'LineWidth', 1) legend( ' TARGET ', ' OUTPUT ' ) title( ' NARXNET EXAMPLE ' )
0 Kommentare
Akzeptierte Antwort
Greg Heath
am 25 Jan. 2018
Insuficient info;
HOW LONG IS ONE DELAY ...
1 second? 1 minute? 1 hour? 1 day?...
although you can recursively predict multiple delays ahead, errors will accumulate and the predictions become meaningless.
There is no magic formula that specifies how many multiples of the maximum delay can be used for predictions before errors accumulate to overwhelm accuracy.
Hope this helps
Thank you for formally accepting my answer
Greg
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!