Prediction and Analysis of data examples of matlab Generalized regression Neural Network GRNN
This article introduces the relevant knowledge of "data case prediction and analysis of matlab generalized regression neural network GRNN". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Generalized regression neural network (GRNN) is a kind of radial basis function neural network (RBF). GRNN has strong nonlinear mapping ability and learning speed, and has stronger advantages than RBF. Finally, the network converges to the optimal regression surface with more sample size, and the prediction effect is better when the sample data is less. In addition, the network can also deal with unstable data, so GRNN has been used in many fields.
% clear environment variables
Clc
Clear
Close all
Nntwarn off
% load data
Load data
Load data and divide the data into two categories: training and prediction
P_train=p (1 Pluto 12:)
T_train=t (1 Pluto 12:)
P_test=p (13th:)
T_test=t (13th:)
%% Cross validation
Desired_spread= []
Mse_max=10e20
Desired_input= []
Desired_output= []
Result_perfp= []
Indices = crossvalind ('Kfold',length (p_train), 4)
H=waitbar (0Jing'is looking for the optimal parameters.')
Kenz1
For I = 1:4
Perfp= []
Disp (['below is', num2str (I), 'second cross-validation result'])
Test = (indices = = I); train = ~ test
P_cv_train=p_train (train,:)
T_cv_train=t_train (train,:)
P_cv_test=p_train (test,:)
T_cv_test=t_train (test,:)
Paired cvents, paired cvents
Tweak cvs. please cvs. cvents
Paired cvested test = paired cvested test`
Tweak cvested testt = tantalcvicitest`
[paired cvents recording minpmin minpMaxpMaxt] = premnmx (pincushion cvents minpjiggumminpparamagmento cvanttrain)
P_cv_test=tramnmx (paired cvested test.minpmenmaxp)
For spread=0.1:0.1:2
Net=newgrnn (packs, cvasses, packs, cv
Waitbar (kink 80th)
Disp (['current spread value is', num2str (spread)])
Test_Out=sim (net,p_cv_test)
Test_Out=postmnmx (test_Out,mint,maxt)
Error=t_cv_test-test_Out
Disp (['mse of the current network is', num2str (mse (error))])
Perfp= [perfp mse (error)]
If mse (error)