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

2 Launch package’s trainPredict

res <- trainPredict_1pkg(1:12, pkgname = "nnet", pkgfun = "nnet", nnet.method,
  prepareZZ.arg = nnet.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.2903 0.0843 0.2288 1.1819 0.07
mFriedman 0.0088 0.0001 0.0070 0.0254 0.08
mIshigami 0.6011 0.3613 0.4353 2.7437 0.14
mRef153 3.2253 10.4025 2.1880 12.8694 0.00
uDmod1 0.0435 0.0019 0.0332 0.1053 0.00
uDmod2 0.0424 0.0018 0.0334 0.0922 0.00
uDreyfus1 0.0022 0.0000 0.0017 0.0042 0.00
uDreyfus2 0.0906 0.0082 0.0722 0.2134 0.00
uGauss1 2.2473 5.0505 1.7364 7.3077 0.03
uGauss2 2.3727 5.6295 1.8605 7.6034 0.01
uGauss3 2.2958 5.2709 1.8285 6.3560 0.01
uNeuroOne 0.2830 0.0801 0.2313 0.5674 0.00
kable(t(apply(res, c(1,4), median)))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
RMSE MSE MAE WAE time
mDette 0.45765 0.20950 0.34465 1.88020 0.080
mFriedman 0.03580 0.00190 0.02805 0.09920 0.095
mIshigami 0.68760 0.47290 0.51225 3.03925 0.150
mRef153 3.41260 11.64860 2.45920 14.12370 0.020
uDmod1 0.04485 0.00200 0.03590 0.12455 0.015
uDmod2 0.05870 0.00345 0.04700 0.12505 0.000
uDreyfus1 0.00230 0.00000 0.00190 0.00730 0.000
uDreyfus2 0.09065 0.00820 0.07250 0.22030 0.000
uGauss1 2.28220 5.20880 1.78145 7.43960 0.030
uGauss2 4.61820 23.49455 3.56380 13.50225 0.025
uGauss3 3.30540 10.94545 2.55245 10.18235 0.025
uNeuroOne 0.28300 0.08010 0.23130 0.56750 0.000