Function to view all adjustment quality statistics of trained RNA repeats

Asked

Viewed 25 times

0

I’m training several Rnas with 100 reps each. I need a function that shows all adjustment quality statistics for all repeats.

# RNA 1 
set.seed(5)
RNA1 <- neuralnet(paste("Ht_norm ~ ", Quant.var), base_treinamento, hidden = 2,
          act.fct = 'logistic' ,algorithm = "rprop+", err.fct = "sse",
          linear.output = FALSE, rep = 100)
plot(RNA1, rep = 1)

where Rep = number of repetitions.

I can observe the adjustment quality statistics one repetition at a time, but it is impossible for me to write 100 lines of code to observe all the adjustment quality statistics for the 100 repetitions. Below the function I created to view such adjustment quality statistics.

# Stat Model Function 
StatModel <- function(obs, est, plotR = TRUE, xlim = NULL, ylim = NULL, col = "black", xlab = "Observed", ylab = "Predicted", main = NULL) {
  rmse <- sqrt(sum((obs-est)^2)/length(obs)) # Root mean square error
  bias <- mean(obs-est) # bias
  rmseR <- 100*sqrt(sum((obs-est)^2)/length(obs))/mean(obs)
  biasR <- 100*mean(obs-est)/mean(obs)
  MAE <- sum((obs-est)^2)/length(obs) # Mean absolute error
  PMRE <- sum(sqrt(((obs-est)/obs)^2)/length(obs))*100 # percent mean relative error. (PMRE)
}

To observe one at a time, I use the sequence:

base_validacao$Ht_RNA1_Est <- predict(RNA1, rep = 1, base_validacao)
StatModel(base_validacao$Ht_norm, base_validacao$Ht_RNA1_Est,
  xlim = c(0,1), ylim = c(0,1), main = "RNA1-Treino" )

Again, where rep = repetition number

  • Welcome to Stackoverflow! Unfortunately, this question cannot be reproduced by anyone trying to answer it. Please take a look at this link (mainly in the use of function dput) and see how to ask a reproducible question in R. So, people who wish to help you will be able to do this in the best possible way.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.