Calculate Coefficient of determination of ANN

조회 수: 2 (최근 30일)
Ninlawat Phuangchoke
Ninlawat Phuangchoke 2020년 11월 30일
댓글: Bob 2022년 12월 4일
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 CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by