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 caret 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(caret)
caret.method <- "none"
hyperParams.caret <- function(...) {
    return (list(iter=maxit2ndorder, trace=FALSE))
}
NNtrain.caret <- function(x, y, dataxy, formula, neur, method, hyperParams, ...) {
    
    hyper_params <- do.call(hyperParams, list(...))
    
    NNreg <- caret::avNNet(x, y, repeats = 3, size = neur, linout = TRUE, trace=hyper_params$trace, bag = TRUE)
    return(NNreg)
}
NNpredict.caret <- function(object, x, ...)
    predict(object, newdata=x)
NNclose.caret <- function()
  if("package:caret" %in% search())
    detach("package:caret", unload=TRUE)
caret.prepareZZ <- list(xdmv = "d", ydmv = "v", zdm = "d", scale = TRUE)
if(FALSE)
res <- trainPredict_1data(1, caret.method, "NNtrain.caret", "hyperParams.caret", "NNpredict.caret", 
                               NNsummary, "NNclose.caret", NA, caret.prepareZZ, nrep=5, echo=TRUE, doplot=FALSE,
                               pkgname="caret", pkgfun="caret", csvfile=TRUE, rdafile=TRUE, odir=odir)

2 Launch package’s trainPredict

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

3 Results

#print(res)
kable(t(apply(res, c(1,4), min)))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
RMSE MSE MAE WAE time
mDette 0.5507 0.3033 0.3613 3.7046 0.11
mFriedman 0.0255 0.0007 0.0205 0.0817 0.14
mIshigami 1.0198 1.0400 0.7412 3.9440 0.22
mRef153 3.1594 9.9818 2.1408 12.7695 0.03
uDmod1 0.0662 0.0044 0.0443 0.1785 0.01
uDmod2 0.0526 0.0028 0.0414 0.1373 0.01
uDreyfus1 0.0076 0.0001 0.0059 0.0141 0.00
uDreyfus2 0.0946 0.0089 0.0747 0.2121 0.00
uGauss1 2.6818 7.1920 2.1479 7.5468 0.04
uGauss2 2.4968 6.2340 1.9845 7.0047 0.04
uGauss3 2.6692 7.1244 2.0996 8.3712 0.04
uNeuroOne 0.2877 0.0828 0.2342 0.5284 0.00
kable(t(apply(res, c(1,4), median)))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
RMSE MSE MAE WAE time
mDette 1.11425 1.28575 0.81225 6.92780 0.120
mFriedman 0.05175 0.00265 0.03985 0.16160 0.150
mIshigami 1.45670 2.13675 1.16535 5.22360 0.240
mRef153 3.33865 11.14670 2.31180 13.38290 0.030
uDmod1 0.08575 0.00745 0.06440 0.25820 0.020
uDmod2 0.07350 0.00540 0.06030 0.20200 0.020
uDreyfus1 0.03885 0.00150 0.02525 0.10725 0.015
uDreyfus2 0.10275 0.01055 0.08330 0.24020 0.020
uGauss1 3.76790 14.20640 2.88475 12.73300 0.055
uGauss2 4.29905 18.49775 3.29020 13.92560 0.050
uGauss3 3.43940 11.83050 2.65935 10.64515 0.050
uNeuroOne 0.29645 0.08785 0.24085 0.66760 0.010