% Solve a Pattern Recognition Problem with a Neural Network % Script generated by NPRTOOL % Created Fri Jan 12 15:36:11 CET 2018 % % This script assumes these variables are defined: % % real_input - input data. % real_output - target data. %load data %load('out_in_pattern_classifier_2018_03_26.mat') inputs = real_input; targets = real_output; % Create a Pattern Recognition Network %hiddenLayerSize1 = 274; hiddenLayerSize1 = 260; %hiddenLayerSize2 = 165; hiddenLayerSize2 = 156; %net = patternnet(hiddenLayerSize1); net = patternnet([hiddenLayerSize1 hiddenLayerSize2]); %choose network algorithm %net.trainFcn = 'trainscg'; net.trainFcn = 'trainrp'; % Setup Division of Data for Training, Validation, Testing net.divideParam.trainRatio = 70/100; net.divideParam.valRatio = 15/100; net.divideParam.testRatio = 15/100; %setup validation times: %net.trainParam.max_fail = 100; %net.trainParam.max_fail = 150; net.trainParam.max_fail = 200; % Train the Network [net,tr] = train(net,inputs,targets); %redo this to get the full plot options with gui % Test the Network outputs = net(inputs); errors = gsubtract(targets,outputs); performance = perform(net,targets,outputs) % View the Network view(net) % Plots % Uncomment these lines to enable various plots. %figure, plotperform(tr) %figure, plottrainstate(tr) %figure, plotconfusion(targets,outputs) %figure, ploterrhist(errors) %Choose save name %save net1_new.mat %save net2_new.mat %save net3_new.mat %save net4_new.mat %save net5_new.mat save net6_new.mat