why my training results are repeated even after i run my code again and again ??
% ANN model for ukraine with all inputs
%% Data loading to the matlab environment
train_data = xlsread(‘Train_M.xlsx’);
input_train = xlsread(‘Train_M’,’input’);
X_train = input_train’;
target_train = xlsread(‘Train_M’,’target’);
T_train = target_train’;
test_data = xlsread(‘Test_M.xlsx’);
input_test = xlsread(‘Test_M’,’input’);
X_test = input_test’;
target_test = xlsread(‘Test_M’,’target’);
T_test = target_test’;
%% normalization of training and testing data
%for training
[Tr_i ps] = mapminmax(X_train,-1,1);
[Tr_t ps] = mapminmax(T_train,-1,1);
%for testing
[Tst_i pp] = mapminmax(X_test,-1,1);
[Tst_t pp] = mapminmax(T_test,-1,1);
%clear
%clc
%load Best_Dataset (need to save our datadivision for avoiding
%randomization)
%% GRNN model development
%% model formulation
spread = 0.42;
net = newgrnn(Tr_i,Tr_t,spread);
view(net);
%% prediction outputs of the model
y_tr = net(Tr_i);
y_tst = net(Tst_i);
%% renormalization process
% Model outputs(forecasted data)
Renorm_train_out = mapminmax(‘reverse’,y_tr,ps);
Renorm_test_out = mapminmax(‘reverse’,y_tst,pp);
%for model inputs(observed data)
Renorm_train_inp = mapminmax(‘reverse’,Tr_t,ps);
Renorm_test_inp = mapminmax(‘reverse’,Tst_t,pp);
%% performance of the ANN model
%Training performance and testing performance
plot(Renorm_test_inp,Renorm_test_out,’x’)%curves is ok
plot(Renorm_train_inp,Renorm_train_out,’x’)%curve is ok
%% statistical measure of the model
%% model performance command
mdl = fitlm(Renorm_test_inp,Renorm_test_out)%testing performance
mdl = fitlm(Renorm_train_inp,Renorm_train_out)%training performance
%% saving the trained model
save(‘GRNN_allinputs.mat’,’net’);
%% the results for the above code repeates.
R2 is 0.68, RMSE 10.8 – training
R2 is 0.639 ,RMSE 3.03 -testing
these results are again shown for the second run and so on
AM i missing something here ???
please help !!!!% ANN model for ukraine with all inputs
%% Data loading to the matlab environment
train_data = xlsread(‘Train_M.xlsx’);
input_train = xlsread(‘Train_M’,’input’);
X_train = input_train’;
target_train = xlsread(‘Train_M’,’target’);
T_train = target_train’;
test_data = xlsread(‘Test_M.xlsx’);
input_test = xlsread(‘Test_M’,’input’);
X_test = input_test’;
target_test = xlsread(‘Test_M’,’target’);
T_test = target_test’;
%% normalization of training and testing data
%for training
[Tr_i ps] = mapminmax(X_train,-1,1);
[Tr_t ps] = mapminmax(T_train,-1,1);
%for testing
[Tst_i pp] = mapminmax(X_test,-1,1);
[Tst_t pp] = mapminmax(T_test,-1,1);
%clear
%clc
%load Best_Dataset (need to save our datadivision for avoiding
%randomization)
%% GRNN model development
%% model formulation
spread = 0.42;
net = newgrnn(Tr_i,Tr_t,spread);
view(net);
%% prediction outputs of the model
y_tr = net(Tr_i);
y_tst = net(Tst_i);
%% renormalization process
% Model outputs(forecasted data)
Renorm_train_out = mapminmax(‘reverse’,y_tr,ps);
Renorm_test_out = mapminmax(‘reverse’,y_tst,pp);
%for model inputs(observed data)
Renorm_train_inp = mapminmax(‘reverse’,Tr_t,ps);
Renorm_test_inp = mapminmax(‘reverse’,Tst_t,pp);
%% performance of the ANN model
%Training performance and testing performance
plot(Renorm_test_inp,Renorm_test_out,’x’)%curves is ok
plot(Renorm_train_inp,Renorm_train_out,’x’)%curve is ok
%% statistical measure of the model
%% model performance command
mdl = fitlm(Renorm_test_inp,Renorm_test_out)%testing performance
mdl = fitlm(Renorm_train_inp,Renorm_train_out)%training performance
%% saving the trained model
save(‘GRNN_allinputs.mat’,’net’);
%% the results for the above code repeates.
R2 is 0.68, RMSE 10.8 – training
R2 is 0.639 ,RMSE 3.03 -testing
these results are again shown for the second run and so on
AM i missing something here ???
please help !!!! % ANN model for ukraine with all inputs
%% Data loading to the matlab environment
train_data = xlsread(‘Train_M.xlsx’);
input_train = xlsread(‘Train_M’,’input’);
X_train = input_train’;
target_train = xlsread(‘Train_M’,’target’);
T_train = target_train’;
test_data = xlsread(‘Test_M.xlsx’);
input_test = xlsread(‘Test_M’,’input’);
X_test = input_test’;
target_test = xlsread(‘Test_M’,’target’);
T_test = target_test’;
%% normalization of training and testing data
%for training
[Tr_i ps] = mapminmax(X_train,-1,1);
[Tr_t ps] = mapminmax(T_train,-1,1);
%for testing
[Tst_i pp] = mapminmax(X_test,-1,1);
[Tst_t pp] = mapminmax(T_test,-1,1);
%clear
%clc
%load Best_Dataset (need to save our datadivision for avoiding
%randomization)
%% GRNN model development
%% model formulation
spread = 0.42;
net = newgrnn(Tr_i,Tr_t,spread);
view(net);
%% prediction outputs of the model
y_tr = net(Tr_i);
y_tst = net(Tst_i);
%% renormalization process
% Model outputs(forecasted data)
Renorm_train_out = mapminmax(‘reverse’,y_tr,ps);
Renorm_test_out = mapminmax(‘reverse’,y_tst,pp);
%for model inputs(observed data)
Renorm_train_inp = mapminmax(‘reverse’,Tr_t,ps);
Renorm_test_inp = mapminmax(‘reverse’,Tst_t,pp);
%% performance of the ANN model
%Training performance and testing performance
plot(Renorm_test_inp,Renorm_test_out,’x’)%curves is ok
plot(Renorm_train_inp,Renorm_train_out,’x’)%curve is ok
%% statistical measure of the model
%% model performance command
mdl = fitlm(Renorm_test_inp,Renorm_test_out)%testing performance
mdl = fitlm(Renorm_train_inp,Renorm_train_out)%training performance
%% saving the trained model
save(‘GRNN_allinputs.mat’,’net’);
%% the results for the above code repeates.
R2 is 0.68, RMSE 10.8 – training
R2 is 0.639 ,RMSE 3.03 -testing
these results are again shown for the second run and so on
AM i missing something here ???
please help !!!! regression, general regression neural network, matlab, programming MATLAB Answers — New Questions