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?
  1 件のコメント
Bob
Bob 2022 年 12 月 4 日
did you find the answer after all?

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by