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 snnR 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

snnR.method <- "none"
hyperParams.snnR <- function(optim_method, ...) {
    out <- list(iter = maxit2ndorder)
    return (out)
}
NNtrain.snnR <- function(x, y, dataxy, formula, hidden_neur, optim_method, hyperParams,...) {
    
    hyper_params <- do.call(hyperParams, list(optim_method, ...))
    
    NNreg <- snnR::snnR(x, y, nHidden = as.matrix(hidden_neur), 
                 iteramax = hyper_params$iter, verbose=FALSE)
    return (NNreg)
}
NNpredict.snnR <- function(object, x, ...)
  predict(object, x)
NNclose.snnR <- function()
  if("package:snnR" %in% search())
    detach("package:snnR", unload=TRUE)
snnR.prepareZZ <- list(xdmv = "m", ydmv = "v", zdm = "d", scale = TRUE)


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

2 Launch package’s trainPredict

res <- trainPredict_1pkg(1:12, pkgname = "snnR", pkgfun = "snnR", snnR.method,
  prepareZZ.arg = snnR.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.8399 0.7054 0.6390 3.7672 0.03
mFriedman 0.0457 0.0021 0.0353 0.1770 0.11
mIshigami 0.6676 0.4456 0.4695 2.7236 0.19
mRef153 4.3529 18.9480 3.2423 15.2576 0.01
uDmod1 0.2927 0.0857 0.2512 0.6561 0.02
uDmod2 0.2585 0.0668 0.2264 0.5023 0.01
uDreyfus1 0.3691 0.1362 0.2756 0.8531 0.00
uDreyfus2 0.3837 0.1473 0.2773 1.0352 0.00
uGauss1 6.3315 40.0882 5.2512 16.1216 0.02
uGauss2 9.4678 89.6394 6.9147 30.1105 0.01
uGauss3 5.2818 27.8976 4.0957 15.6474 0.01
uNeuroOne 0.6793 0.4615 0.5564 1.6288 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.63810 2.8048 1.25380 9.24805 0.080
mFriedman 0.05945 0.0036 0.04775 0.20870 0.130
mIshigami 0.86210 0.7433 0.60300 3.63200 0.395
mRef153 4.35290 18.9480 3.24230 15.25765 0.030
uDmod1 0.35950 0.1293 0.31160 0.80470 0.030
uDmod2 0.25850 0.0668 0.22640 0.50230 0.025
uDreyfus1 0.36910 0.1362 0.27560 0.85310 0.000
uDreyfus2 0.38370 0.1473 0.27730 1.03520 0.010
uGauss1 11.61750 134.9658 9.57490 25.91460 0.030
uGauss2 9.51690 90.5717 7.00610 30.25900 0.030
uGauss3 5.28180 27.8977 4.09570 15.64745 0.025
uNeuroOne 0.67930 0.4615 0.55640 1.62880 0.000