# Rsq from NMSE in NN

조회 수: 6 (최근 30일)
vanrapa 2019년 3월 31일
편집: Greg Heath 2019년 4월 1일
I am trying to find out the best number of hidden neurons for a network. I am training the network in a loop with different number of hidden neurons and storing the value of NMSE and Rsq for each iteration.
My ip database size is 20 x 714 and op database is 3 x 714. I am dividing the dataset as 70% training and 15% for validation and testing each.
I have computed NMSE and Rsq in the usual manner,
MSE00 = mean(var(trnopdb',1))
NMSE = mse(trnopdb'-net(trnipdb'))/MSE00
Rsq = 1 - NMSE
Now I have the following queries,
1. The value of Rsq is negative. It does not lie between 0 and 1. What am I doing wrong?
2. Also, matlab nnfit displays Rtraining, Rvalidation, Rtesting and Rall as positive values. So what is the relation between Rsq and the R values?
3. Is it possible to extract the R values from the network info?
4. Should I consider Rtesting as the network performance criteria or the other R values?
I am sure there might be lots of info about these trivial questions. Nonetheless I seem to have these doubts. So any help would be great. Thanks in advance.

댓글을 달려면 로그인하십시오.

### 채택된 답변

Greg Heath 2019년 4월 1일
편집: Greg Heath 2019년 4월 1일
1. NMSE = mse(trnopdb-net(trnipdb))/MSE00
i.e., NO TRANSPOSES
2. Rsq = R^2
3. Yes. Use separate calculations for the training, validation and training subsets.
4. I typically make 10 or more designs differing by random number initializations. Then I use the summary stats of NMSE.
Hope this helps
Thank you for formally accepting my answer
Greg

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

R2017a

### Community Treasure Hunt

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

Start Hunting!

Translated by