请问在时间序列数据上怎样预测呢? (如图)
已知x1,x2…为输入变量, x3为输出变量
训练和测试的比例为80/20
当训练完成后要做预测(比如预测之后10个数值), 请问matlab怎样做到?
附上程序, 差最后预测步骤, 求解
- inputSeries = tonndata(time_in,true,false);
- targetSeries = tonndata(time_out,true,false);
- % Create a Time Delay Network
- inputDelays = 0:1;
- hiddenLayerSize = 10;
- net = timedelaynet(inputDelays,hiddenLayerSize);
- net.inputs{1}.processFcns = {'removeconstantrows','mapminmax'};
- net.outputs{2}.processFcns = {'removeconstantrows','mapminmax'};
- [inputs,inputStates,layerStates,targets] = preparets(net,inputSeries,targetSeries);
- net.divideFcn = 'divideblock'; % Divide data randomly
- net.divideMode = 'time'; % Divide up every value
- net.divideParam.trainRatio = 80/100;
- net.divideParam.valRatio = 20/100;
- net.divideParam.testRatio = 0/100;
- net.trainFcn = 'trainlm'; % Levenberg-Marquardt
- net.performFcn = 'mse'; % Mean squared error
- % Choose Plot Functions
- % For a list of all plot functions type: help nnplot
- net.plotFcns = {'plotperform','plottrainstate','plotresponse', ...
- 'ploterrcorr', 'plotinerrcorr'};
- % 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)
- % Recalculate Training, Validation and Test Performance
- trainTargets = gmultiply(targets,tr.trainMask);
- valTargets = gmultiply(targets,tr.valMask);
- testTargets = gmultiply(targets,tr.testMask);
- trainPerformance = perform(net,trainTargets,outputs)
- valPerformance = perform(net,valTargets,outputs)
- testPerformance = perform(net,testTargets,outputs)
- % View the Network
- view(net)
- % Plots
- % Uncomment these lines to enable various plots.
- figure, plotperform(tr)
- figure, plottrainstate(tr)
- figure, plotresponse(targets,outputs)
- figure, ploterrcorr(errors)
- figure, plotinerrcorr(inputs,errors)


雷达卡



京公网安备 11010802022788号







