fix f.
[wrf-fire-matlab.git] / fuel_left / train_simple.m
blobc82b2e04a655f0156514533c52141d013cda0275
1 % Solve an Input-Output Fitting problem with a Neural Network
2 % Script generated by Neural Fitting app
3 % Created 20-Jun-2022 16:00:45
5 % This script assumes these variables are defined:
7 %   s - input data.
8 %   r - target data.
10 x = s;
11 t = r;
13 % Choose a Training Function
14 % For a list of all training functions type: help nntrain
15 % 'trainlm' is usually fastest.
16 % 'trainbr' takes longer but may be better for challenging problems.
17 % 'trainscg' uses less memory. Suitable in low memory situations.
18 trainFcn = 'trainlm';  % Levenberg-Marquardt backpropagation.
20 % Create a Fitting Network
21 hiddenLayerSize = 10;
22 net = fitnet(hiddenLayerSize,trainFcn);
24 % Setup Division of Data for Training, Validation, Testing
25 net.divideParam.trainRatio = 70/100;
26 net.divideParam.valRatio = 15/100;
27 net.divideParam.testRatio = 15/100;
29 % Train the Network
30 [net,tr] = train(net,x,t);
32 % Test the Network
33 y = net(x);
34 e = gsubtract(t,y);
35 performance = perform(net,t,y)
37 % View the Network
38 view(net)
40 % Plots
41 % Uncomment these lines to enable various plots.
42 %figure, plotperform(tr)
43 %figure, plottrainstate(tr)
44 %figure, ploterrhist(e)
45 %figure, plotregression(t,y)
46 %figure, plotfit(net,x,t)