1 Setup

1.1 Packages and options

library(NNbenchmark)
library(kableExtra)
options(scipen = 999)

1.2 Datasets to test

NNdataSummary(NNdatasets)
##      Dataset n_rows n_inputs n_neurons n_parameters
## 1     mDette    500        3         5           26
## 2  mFriedman    500        5         5           36
## 3  mIshigami    500        3        10           51
## 4    mRef153    153        5         3           22
## 5     uDmod1     51        1         6           19
## 6     uDmod2     51        1         5           16
## 7  uDreyfus1     51        1         3           10
## 8  uDreyfus2     51        1         3           10
## 9    uGauss1    250        1         5           16
## 10   uGauss2    250        1         4           13
## 11   uGauss3    250        1         4           13
## 12 uNeuroOne     51        1         2            7

1.3 RSNNS trainPredict arguments - inputs x, y

if(dir.exists("D:/GSoC2020/Results/2020run03/"))
{  
  odir <- "D:/GSoC2020/Results/2020run03/"
}else if(dir.exists("~/Documents/recherche-enseignement/code/R/NNbenchmark-project/NNtempresult/"))
{  
  odir <- "~/Documents/recherche-enseignement/code/R/NNbenchmark-project/NNtempresult/"
}else
  odir <- "~"

nrep <- 10
maxit2ndorder  <-    200
maxit1storderA <-   1000
maxit1storderB <-  10000
maxit1storderC <- 100000

#library(RSNNS)
RSNNS.method <- c("Rprop","BackpropBatch","BackpropChunk","BackpropMomentum",
                  "BackpropWeightDecay","Quickprop","SCG","Std_Backpropagation")
hyperParams.RSNNS <- function(optim_method, ...) {
    
    if (optim_method == "Std_Backpropagation")   {iter <- maxit1storderA} 
    if (optim_method == "BackpropBatch")         {iter <- maxit1storderB}
    if (optim_method == "BackpropChunk")         {iter <- maxit1storderA}
    if (optim_method == "BackpropMomentum")      {iter <- maxit1storderA}
    if (optim_method == "BackpropWeightDecay")   {iter <- maxit1storderA}
    if (optim_method == "Rprop")                 {iter <- maxit1storderA}
    if (optim_method == "Quickprop")             {iter <- maxit1storderB}
    if (optim_method == "SCG")                   {iter <- maxit1storderA}

    out <- list(iter = iter)
    return(out)
}
NNtrain.RSNNS <- function(x, y, dataxy, formula, hidden_neur, optim_method, hyperParams, NNfullformula, NNparam,...) {
    
    hyper_params <- do.call(hyperParams, list(optim_method, ...))
    if (optim_method == "Std_Backpropagation" || optim_method == "BackpropBatch"){
          NNreg <- RSNNS::mlp(x, y, size = hidden_neur, learnFunc = optim_method, learnFuncParams = c(0.1), #lr 
                        maxit = hyper_params$iter, linOut = TRUE)
    } else {
          NNreg <- RSNNS::mlp(x, y, size = hidden_neur, learnFunc = optim_method,
                        maxit = hyper_params$iter, linOut = TRUE)
    }
    
    return (NNreg)
}
NNpredict.RSNNS <- function(object, x, ...)
  predict(object, x)
NNclose.RSNNS <- function()
  if("package:RSNNS" %in% search())
    detach("package:RSNNS", unload=TRUE)
RSNNS.prepareZZ <- list(xdmv = "m", ydmv = "m", zdm = "d", scale = TRUE)


if(FALSE)
res <- train_and_predict_1data(1, RSNNS.method, "NNtrain.RSNNS", "hyperParams.RSNNS", "NNpredict.RSNNS", 
                               NNsummary, "NNclose.RSNNS", NA, RSNNS.prepareZZ, nrep=5, echo=TRUE, doplot=FALSE,
                               pkgname="RSNNS", pkgfun="mlp", rdafile=TRUE, odir=odir)

2 Launch package’s trainPredict

res <- trainPredict_1pkg(1:12, pkgname = "RSNNS", pkgfun = "mlp", RSNNS.method,
  prepareZZ.arg = RSNNS.prepareZZ, nrep = nrep, doplot = FALSE,
  csvfile = TRUE, rdafile = TRUE, odir = odir, echo = FALSE)

3 Results

#print(res)
kable(apply(res[,,1,], c(3,1), min), caption = "Rprop")%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
Rprop
RMSE MSE MAE WAE time
mDette 0.5709 0.3259 0.4394 2.1676 0.58
mFriedman 0.0263 0.0007 0.0207 0.0853 0.58
mIshigami 0.8069 0.6510 0.5909 3.3266 0.71
mRef153 3.2667 10.6712 2.3033 13.4889 0.16
uDmod1 0.0578 0.0033 0.0445 0.1814 0.08
uDmod2 0.0744 0.0055 0.0623 0.1463 0.07
uDreyfus1 0.0617 0.0038 0.0450 0.1563 0.06
uDreyfus2 0.1122 0.0126 0.0884 0.2629 0.06
uGauss1 2.8942 8.3762 2.2345 9.7323 0.28
uGauss2 3.5399 12.5309 2.6525 13.2235 0.26
uGauss3 2.6559 7.0538 2.1042 7.8999 0.27
uNeuroOne 0.2830 0.0801 0.2312 0.5665 0.04
kable(apply(res[,,2,], c(3,1), min), caption = "BackpropBatch")%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
BackpropBatch
RMSE MSE MAE WAE time
mDette 1.3901 1.9323 1.1149 6.5646 5.86
mFriedman 0.0356 0.0013 0.0274 0.1387 5.97
mIshigami 2.6336 6.9360 2.2660 6.7254 7.58
mRef153 3.5771 12.7953 2.6208 13.7695 1.75
uDmod1 0.3276 0.1073 0.2773 0.7405 0.78
uDmod2 0.1722 0.0296 0.1346 0.4173 0.76
uDreyfus1 0.3256 0.1060 0.2575 0.6937 0.68
uDreyfus2 0.3019 0.0911 0.2342 0.8008 0.69
uGauss1 14.0515 197.4456 11.3434 38.7526 2.99
uGauss2 12.6808 160.8028 10.3220 26.8884 2.80
uGauss3 5.9202 35.0490 4.6467 16.3500 2.78
uNeuroOne 0.2885 0.0832 0.2358 0.6160 0.65
kable(apply(res[,,3,], c(3,1), min), caption = "BackpropChunk")%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
BackpropChunk
RMSE MSE MAE WAE time
mDette 0.6634 0.4401 0.5049 2.6444 0.59
mFriedman 0.0395 0.0016 0.0308 0.1718 0.62
mIshigami 1.8762 3.5200 1.3996 7.6244 0.72
mRef153 3.3911 11.4996 2.3498 12.7548 0.17
uDmod1 0.1306 0.0171 0.0888 0.4049 0.06
uDmod2 0.0799 0.0064 0.0631 0.1663 0.07
uDreyfus1 0.0717 0.0051 0.0590 0.1764 0.06
uDreyfus2 0.1175 0.0138 0.0930 0.2637 0.06
uGauss1 2.8405 8.0685 2.1772 8.4196 0.29
uGauss2 3.2770 10.7389 2.5878 11.2537 0.28
uGauss3 2.7491 7.5574 2.1950 7.3436 0.28
uNeuroOne 0.2869 0.0823 0.2385 0.5749 0.06
kable(apply(res[,,4,], c(3,1), min), caption = "BackpropMomentum")%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
BackpropMomentum
RMSE MSE MAE WAE time
mDette 0.6550 0.4291 0.4905 2.2000 0.57
mFriedman 0.0476 0.0023 0.0375 0.1649 0.59
mIshigami 2.6391 6.9649 2.0594 9.5926 0.70
mRef153 3.4035 11.5835 2.3942 11.7853 0.17
uDmod1 0.1223 0.0149 0.0962 0.3378 0.07
uDmod2 0.0681 0.0046 0.0570 0.1612 0.07
uDreyfus1 0.0801 0.0064 0.0613 0.2021 0.06
uDreyfus2 0.1177 0.0138 0.0931 0.2634 0.06
uGauss1 2.7202 7.3997 2.1139 8.0885 0.29
uGauss2 3.2581 10.6155 2.5245 10.3705 0.28
uGauss3 2.8889 8.3458 2.2397 7.7426 0.28
uNeuroOne 0.2840 0.0807 0.2325 0.5243 0.06
kable(apply(res[,,5,], c(3,1), min), caption = "BackpropWeightDecay")%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
BackpropWeightDecay
RMSE MSE MAE WAE time
mDette 0.6556 0.4298 0.5026 2.3936 0.58
mFriedman 0.0423 0.0018 0.0329 0.1724 0.61
mIshigami 2.6245 6.8878 2.0449 8.3924 0.75
mRef153 3.3903 11.4940 2.3312 13.5369 0.17
uDmod1 0.1398 0.0196 0.1026 0.4284 0.07
uDmod2 0.0840 0.0071 0.0661 0.2009 0.08
uDreyfus1 0.0793 0.0063 0.0604 0.1641 0.06
uDreyfus2 0.1174 0.0138 0.0928 0.2658 0.06
uGauss1 2.8753 8.2674 2.3058 8.5280 0.29
uGauss2 3.8043 14.4727 3.1540 10.1419 0.28
uGauss3 2.8868 8.3334 2.2915 8.1451 0.28
uNeuroOne 0.2856 0.0816 0.2353 0.5634 0.06
kable(apply(res[,,6,], c(3,1), min), caption = "Quickprop")%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
Quickprop
RMSE MSE MAE WAE time
mDette 7.1061 50.4966 5.7241 28.2385 6.46
mFriedman 0.1616 0.0261 0.1255 0.5029 6.50
mIshigami 3.4786 12.1008 2.8157 13.1137 8.72
mRef153 8.2933 68.7780 6.3301 23.9933 1.80
uDmod1 0.5187 0.2690 0.4371 1.0104 0.77
uDmod2 0.3034 0.0920 0.2507 0.7222 0.76
uDreyfus1 0.1885 0.0355 0.1319 0.5113 0.70
uDreyfus2 0.2410 0.0581 0.1938 0.5141 0.69
uGauss1 27.1904 739.3189 21.5229 66.1948 3.23
uGauss2 24.6889 609.5424 19.6622 51.2912 3.03
uGauss3 28.0694 787.8906 22.3771 52.4043 2.98
uNeuroOne 0.5304 0.2813 0.4235 1.2829 0.64
kable(apply(res[,,7,], c(3,1), min), caption = "SCG")%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
SCG
RMSE MSE MAE WAE time
mDette 0.4080 0.1664 0.3044 1.7469 0.88
mFriedman 0.0197 0.0004 0.0154 0.0616 0.80
mIshigami 0.6909 0.4774 0.5132 2.7162 1.18
mRef153 3.2673 10.6755 2.2672 13.6828 0.24
uDmod1 0.0547 0.0030 0.0436 0.1388 0.11
uDmod2 0.0523 0.0027 0.0437 0.1159 0.11
uDreyfus1 0.1002 0.0100 0.0815 0.2259 0.08
uDreyfus2 0.1041 0.0108 0.0826 0.2673 0.09
uGauss1 2.8599 8.1791 2.3042 8.8957 0.47
uGauss2 5.0971 25.9805 3.6184 14.6431 0.42
uGauss3 3.6281 13.1631 2.7798 10.6704 0.36
uNeuroOne 0.2866 0.0821 0.2342 0.6125 0.06
kable(apply(res[,,8,], c(3,1), min), caption = "Std_Backpropagation")%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
Std_Backpropagation
RMSE MSE MAE WAE time
mDette 0.4917 0.2418 0.3797 1.9109 0.56
mFriedman 0.0402 0.0016 0.0322 0.1328 0.59
mIshigami 0.9781 0.9566 0.7572 3.5234 0.69
mRef153 3.2695 10.6895 2.3606 13.0491 0.17
uDmod1 0.1106 0.0122 0.0871 0.3298 0.07
uDmod2 0.0757 0.0057 0.0626 0.1553 0.06
uDreyfus1 0.1077 0.0116 0.0871 0.2244 0.06
uDreyfus2 0.1289 0.0166 0.0998 0.2835 0.06
uGauss1 2.8593 8.1756 2.2813 8.6746 0.28
uGauss2 3.4239 11.7233 2.6003 13.0320 0.28
uGauss3 2.9484 8.6932 2.3186 7.7125 0.28
uNeuroOne 0.2834 0.0803 0.2296 0.5755 0.06