_ inputs = Inputs7old'; targets = Mnt2old'; % Create a Fitting Network hiddenLayerSize = 10; FIT1 = fitnet(hiddenLayerSize); FIT1.numLayers = 3; FIT1.layers{2}.name='Hidden2'; FIT1.layers{3}.name='Output'; FIT1.layers{2}.dimensions=10; FIT1.layers{3}.dimensions=1; FIT1.inputConnect = [1; 0; 0]; FIT1.layerConnect = [0 0 0;1 0 0;1 1 0]; FIT1.outputConnect = [0 0 1]; % Choose Input and Output Pre/Post-Processing Functions % For a list of all processing functions type: help nnprocess FIT1.inputs{1}.processFcns = {'removeconstantrows','mapminmax'}; FIT1.outputs{2}.processFcns = {'removeconstantrows','mapminmax'}; %Initilization Functions FIT1.layers{1}.initFcn = 'initnw'; FIT1.layers{2}.initFcn = 'initnw'; FIT1.layers{3}.initFcn = 'initnw'; %Net Input Functions FIT1.layers{1}.netInputFcn = 'netsum'; FIT1.layers{2}.netInputFcn = 'netsum'; FIT1.layers{3}.netInputFcn = 'netsum'; %Transfer functions FIT1.layers{1}.transferFcn = 'satlin'; FIT1.layers{2}.transferFcn = 'purelin'; FIT1.layers{3}.transferFcn = 'purelin'; %Input Weights delays FIT1.inputWeights{2,1}.delays=0; FIT1.inputWeights{3,1}.delays=0; %Input Weights learning FIT1.inputWeights{1,1}.learn=1; FIT1.inputWeights{2,1}.learn=1; FIT1.inputWeights{3,1}.learn=1; FIT1.inputWeights{1,1}.learnFcn='learncon'; FIT1.inputWeights{2,1}.learnFcn='learncon'; FIT1.inputWeights{3,1}.learnFcn='learncon'; %Layer Weight Functions FIT1.layerWeights{1,2}.weightFcn='normprod'; FIT1.layerWeights{1,3}.weightFcn='normprod'; FIT1.layerWeights{2,3}.weightFcn='normprod'; ; %Layer Initialization Functions %FIT1.layerWeights{1,2}.initFcn='initcon'; %FIT1.layerWeights{1,3}.weightFcn='normprod'; %FIT1.layerWeights{2,3}.weightFcn='normprod'; %view(FIT1) % Setup Division of Data for Training, Validation, Testing % For a list of all data division functions type: help nndivide FIT1.divideFcn = 'dividerand'; % Divide data randomly FIT1.divideMode = 'sample'; % Divide up every sample FIT1.divideParam.trainRatio = 64/100; FIT1.divideParam.testRatio = 16/100; FIT1.divideParam.valRatio = 20/100; % For help on training function 'trainlm' type: help trainlm % For a list of all training functions type: help nntrain FIT1.trainFcn = 'trainrp'; % Resilient Backpropagation %FIT1.trainFcn = 'trainlm'; % Levenberg-Marquardt %FIT1.trainFcn = 'trainscg'; % Scaled Conjugate Gradient %FIT1.trainFcn = 'trainbr'; % Bayesian Regularization %FIT1.trainFcn = 'traingdm'; % Gradient descent with momentum backpropagation %FIT1.trainFcn = 'trainb'; % Batch training %FIT1.trainFcn = 'trainbfg'; % BFGS quasi-Newton backpropagation %FIT1.trainFcn = 'traincgb'; % Conjugate gradient backpropagation with Powell-Beale restarts %FIT1.trainFcn = 'trainoss'; % One-step secant backpropagation %FIT1.trainFcn = 'trainr'; % Random order incremental training with learning functions %FIT1.trainFcn = 'trains'; % Sequential order incremental training with learning functions %Training Parameters FIT1.trainParam.epochs=1000; FIT1.trainParam.time=Inf; FIT1.trainParam.min_grad=0.00001; FIT1.trainParam.max_fail=6; FIT1.trainParam.delta0=0.07; FIT1.trainParam.delta_inc=1.25; FIT1.trainParam.delta_dec=0.5; FIT1.trainParam.deltamax=50; % Choose a Performance Function % For a list of all performance functions type: help nnperformance FIT1.performFcn = 'mse'; % Mean squared error % Choose Plot Functions % For a list of all plot functions type: help nnplot FIT1.plotFcns = {'plotperform','plottrainstate','ploterrhist', ... 'plotregression', 'plotfit'}; % Train the Network [FIT1,tr] = train(FIT1,inputs,targets); % Test the Network outputs = FIT1(inputs); %Outputs >0 for i=1:size(Mnt2old) if outputs(1,i) <0 outputs(1,i)=0.001; end end errors = gsubtract(targets,outputs); performance = perform(FIT1,targets,outputs) Rtr=corrcoef(outputs,Mnt2old); R2tr=Rtr(1,2)^2 for i=1:max(size(errors)) errors2(1,i)=errors(1,i)^2; end RMSEtr= (mse(errors,outputs))^0.5; MSEtr=(sum(errors2))/max(size(Mnt2old)); RMSEtr2=MSEtr^0.5; old=max(size(Mnt2old)); Mtrain=mean(Mnt2old); Mquadrerrtrain=RMSEtr/(max(size(Mnt2old))^(0.5)); EpctMquad=100*Mquadrerrtrain/Mtrain Maritmerrtrain=mean(abs(errors)); EpctMaritm=100*Maritmerrtrain/Mtrain EpctRMSE=100+RMSEtr/Mtrain PeaksErrratioT=EpctRMSE/EpctMaritm % Recalculate Training, Validation and Test Performance trainTargets = targets .* tr.trainMask{1}; %valTargets = targets .* tr.valMask{1}; %testTargets = targets .* tr.testMask{1}; trainPerformance = perform(FIT1,trainTargets,outputs); %valPerformance = perform(FF1,valTargets,outputs) %testPerformance = perform(FF1,testTargets,outputs) % View the Network %view(FF1) % Plots % Uncomment these lines to enable various plots. %figure, plotperform(tr) %figure, plottrainstate(tr) %figure, plotfit(net,inputs,targets) %figure, plotregression(targets,outputs) %figure, ploterrhist(errors) %Validation Outputval=FIT1(Inputs72011'); for i=1:size(Mnt22011) if Outputval(1,i) <0 Outputval(1,i)=0.001; end end plot (Outputval,'r') hold on plot (Mnt22011,'g') hold off Rval = corrcoef(Outputval,Mnt22011); R2val=Rval(1,2)^2 errval=(Outputval-Mnt22011'); for i=1:max(size(errval)) errval2(1,i)=errval(1,i)^2; end RMSEval= (mse(errval,Outputval))^0.5; MSEval=(sum(errval2))/max(size(Mnt22011)); new=max(size(Mnt22011)); Mval=mean(Mnt22011); Mquadrerrval=RMSEval/(max(size(Mnt22011))^(0.5)); EpcvMquad=100*Mquadrerrval/Mval Maritmerrval=mean(abs(errval)); EpcvMaritm=100*Maritmerrval/Mval EpcvRMSE=100*RMSEval/Mval PeaksErrratioV=EpcvRMSE/EpcvMaritm_
errors = gsubtract(Mnt2old',ytr); R2tr=Rtr(1,2)^2 for i=1:max(size(errors)) errors2(1,i)=errors(1,i)^2; end RMSEtr= (mse(errors,ytr))^0.5; MSEtr=(sum(errors2))/max(size(Mnt2old)); old=max(size(Mnt2old)); Mtrain=mean(Mnt2old); Mquadrerrtrain=RMSEtr*(max(size(Mnt2old))^(-0.5)); EpctRMSE=100*RMSEtr/Mtrain EpctMquad=100*Mquadrerrtrain/Mtrain Maritmerrt=mean(abs(errors)); EpctMaritm=100*Maritmerrt/Mtrain PeaksErrRatioT=EpctRMSE/EpctMaritm yval=GRNN(Inputs72011'); figure2=plot(yval,'b'); hold on plot(Mnt22011,'g') hold off Rval = corrcoef(yval,Mnt22011); R2val=Rval(1,2)^2 errval=(yval-Mnt22011'); for i=1:max(size(errval)) errval2(1,i)=errval(1,i)^2; end RMSEval= (mse(errval,yval))^0.5; MSEval=(sum(errval2))/max(size(Mnt22011)); new=max(size(Mnt22011)); Mval=mean(Mnt22011); Merrvalquadr=RMSEval/(max(size(Mnt22011))^(0.5)); EpcvMquadr=100*Merrvalquadr/Mval; Merrvalaritm=mean(abs(errval)); EpcvMaritm=100*Merrvalaritm/Mval EpcvRMSE=100*RMSEval/Mval PeaksErrRatioV=EpcvRMSE/EpcvMaritm_
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.