Calculate Coefficient of determination of ANN
1 次查看(过去 30 天)
显示 更早的评论
I try to calculate coefficient of determination of ANN as follow
clear all
close all
clc
% Load data
load Model1_input.mat
load Model1_output.mat
% Initialize for test data
test_r_sqr = []
test_mse = []
test_mae = []
% Normalize input
x = normalize(model1_input, 'range', [-1 1]);
% Create network
net= newff(minmax(x),[5,2],{'tansig','purelin'},'traingdx');
% Train & Test
input = x(:,1:598);
target = model1_output(:,1:598);
% Validation
tstind2 = x(:,599:717);
tstint2 = model1_output(:,599:717);
% Split data train & test
net.divideFcn = 'dividerand'
net.divideParam.trainRatio= 0.8; % we use 80% of the data for training
net.divideParam.testRatio= 0.2; % 20% is for validation
net.divideParam.valRatio= 0;
% Ttain and validat neural network
[net,tr]=train(net,input,target);
y = net(input);
% Calculate r-sqr ,mse and mae of test data
[o,l,k] = postreg(y(tr.testInd),target(tr.testInd));
error1=target(tr.testInd)-y(tr.testInd);
MSEperf1=mse(error1);
MAEperf1=mae(error1);
r_sqr1=k^2;
test_r_sqr = round([test_r_sqr,r_sqr1],3);
test_mse = round([test_mse,MSEperf1],3);
test_mae = round([test_mae,MAEperf1],3);
coefficient of determination(k) from code not equal to coefficient of determination (Test) from picture which get from train neural network.Please clarify which code or train correct ? Why are they different?
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Deep Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!