Matlab的processFcns,跪求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)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值