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 brnn 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(brnn)
brnn.method <- "Gauss-Newton"
hyperParams.brnn <- function(optim_method, ...) {
    return(list(iter = maxit2ndorder))
}
NNtrain.brnn <- function(x, y, dataxy, formula, neur, optim_method, hyperParams,...) {
    
    hyper_params <- do.call(hyperParams.brnn, list(brnn.method))
    iter <- hyper_params$iter
    
    NNreg <- brnn::brnn(x, y, neur, normalize = FALSE, epochs = iter, verbose = FALSE)
    return (NNreg)
}
NNpredict.brnn <- function(object, x, ...)
    predict(object, x)
NNclose.brnn <- function()
  if("package:brnn" %in% search())
    detach("package:brnn", unload=TRUE)
brnn.prepareZZ <- list(xdmv = "m", ydmv = "v", zdm = "d", scale = TRUE)
if(FALSE)
res <- trainPredict_1data(1, brnn.method, "NNtrain.brnn", "hyperParams.brnn", "NNpredict.brnn", 
                               NNsummary, "NNclose.brnn", NA, brnn.prepareZZ, nrep=5, echo=TRUE, doplot=FALSE,
                               pkgname="brnn", pkgfun="brnn", csvfile=TRUE, rdafile=TRUE, odir=odir)
if(FALSE)
res <- trainPredict_1mth1data(1, brnn.method[1], "NNtrain.brnn", "hyperParams.brnn", "NNpredict.brnn", 
                               NNsummary, brnn.prepareZZ, nrep=5, echo=TRUE, doplot=FALSE,
                               pkgname="brnn", pkgfun="brnn", csvfile=TRUE, rdafile=TRUE, odir=odir)

2 Launch package’s trainPredict

res <- trainPredict_1pkg(1:12, pkgname = "brnn", pkgfun = "brnn", brnn.method,
  prepareZZ.arg = brnn.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.2295 0.0526 0.1846 0.8032 0.20
mFriedman 0.0046 0.0000 0.0037 0.0139 0.25
mIshigami 0.6362 0.4047 0.4883 2.6808 0.17
mRef153 3.3426 11.1727 2.3126 13.7293 0.00
uDmod1 0.0451 0.0020 0.0364 0.1166 0.00
uDmod2 0.0435 0.0019 0.0346 0.1072 0.00
uDreyfus1 0.0025 0.0000 0.0019 0.0082 0.00
uDreyfus2 0.0913 0.0083 0.0730 0.2241 0.00
uGauss1 2.2526 5.0741 1.7489 7.2646 0.01
uGauss2 2.3781 5.6555 1.8657 7.3796 0.01
uGauss3 2.4917 6.2084 1.9659 7.4363 0.01
uNeuroOne 0.3521 0.1240 0.2848 0.8233 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.50465 2.26530 1.28140 4.95405 0.220
mFriedman 0.00495 0.00000 0.00400 0.01480 0.270
mIshigami 0.66595 0.44345 0.51150 2.93530 0.260
mRef153 3.47940 12.10650 2.50675 14.12545 0.020
uDmod1 0.04510 0.00200 0.03640 0.11670 0.005
uDmod2 0.06435 0.00415 0.05310 0.14720 0.020
uDreyfus1 0.00560 0.00000 0.00455 0.01520 0.000
uDreyfus2 0.09130 0.00830 0.07300 0.22410 0.000
uGauss1 2.41650 5.83930 1.88140 8.39890 0.035
uGauss2 2.37810 5.65550 1.86570 7.37970 0.045
uGauss3 3.01195 9.10600 2.36310 8.83710 0.030
uNeuroOne 0.35230 0.12410 0.28480 0.82700 0.000