% Solve an Input-Output Fitting problem with a Neural Network % Script generated by Neural Fitting app % Created Mon Feb 10 00:18:51 CET 2020 % % This script assumes these variables are defined: % % Xul - input data. % Y - target data. x = Xul'; t = Y'; % Choose a Training Function % For a list of all training functions type: help nntrain % 'trainlm' is usually fastest. % 'trainbr' takes longer but may be better for challenging problems. % 'trainscg' uses less memory. NFTOOL falls back to this in low memory situations. trainFcn = 'trainbr'; % Bayesian Regularization % Create a Fitting Network hiddenLayerSize = 20; net = fitnet(hiddenLayerSize,trainFcn); % Setup 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,x,t); % Test the Network y = net(x); e = gsubtract(t,y); performance = perform(net,t,y) % View the Network view(net) % Plots % Uncomment these lines to enable various plots. %figure, plotperform(tr) %figure, plottrainstate(tr) %figure, plotfit(net,x,t) %figure, plotregression(t,y) %figure, ploterrhist(e)