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 qrnn 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(qrnn)
qrnn.method <- "none"
hyperParams.qrnn <- function(optim_method, ...) {
    
    iter <- maxit2ndorder
    init.range = c(-0.1, 0.1, -0.1, 0.1)
  
    out <- list(iter = iter, init.range=init.range)
    return (out)
}
NNtrain.qrnn <- function(x, y, dataxy, formula, neur, optim_method, hyperParams,...) {
    
    hyper_params <- do.call(hyperParams, list(optim_method, ...))
    
    NNreg <- qrnn::qrnn.fit(x, y, n.hidden = neur, 
                     iter.max = hyper_params$iter, n.trials = 1,
                     init.range = hyper_params$init.range, trace=FALSE)
    
    return (NNreg)
}
NNpredict.qrnn <- function(object, x, ...)
  qrnn::qrnn.predict(x, object)
NNclose.qrnn <- function()
  if("package:qrnn" %in% search())
    detach("package:qrnn", unload=TRUE)
qrnn.prepareZZ <- list(xdmv = "m", ydmv = "m", zdm = "d", scale = TRUE)
if(FALSE)
res <- trainPredict_1data(1, qrnn.method, "NNtrain.qrnn", "hyperParams.qrnn", "NNpredict.qrnn", 
                               NNsummary, "NNclose.qrnn", NA, qrnn.prepareZZ, nrep=5, echo=TRUE, doplot=FALSE,
                               pkgname="qrnn", pkgfun="qrnn.fit", csvfile=TRUE, rdafile=TRUE, odir=odir)

2 Launch package’s trainPredict

res <- trainPredict_1pkg(1:12, pkgname = "qrnn", pkgfun = "qrnn.fit", qrnn.method,
  prepareZZ.arg = qrnn.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.3562 0.1268 0.2420 1.7713 0.16
mFriedman 0.0121 0.0001 0.0081 0.0413 0.28
mIshigami 0.6514 0.4244 0.3720 3.5412 0.61
mRef153 3.3111 10.9635 2.0802 13.5466 0.15
uDmod1 0.0601 0.0036 0.0425 0.1886 0.13
uDmod2 0.0606 0.0037 0.0428 0.1535 0.07
uDreyfus1 0.0087 0.0001 0.0059 0.0230 0.06
uDreyfus2 0.0967 0.0093 0.0709 0.2487 0.08
uGauss1 2.3495 5.5204 1.8349 7.0225 0.13
uGauss2 2.4028 5.7734 1.8803 7.9335 0.09
uGauss3 2.3342 5.4485 1.8016 7.3949 0.13
uNeuroOne 0.2939 0.0864 0.2258 0.7231 0.05
kable(t(apply(res, c(1,4), median)))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
RMSE MSE MAE WAE time
mDette 1.03775 1.07710 0.63025 7.70380 0.390
mFriedman 0.02030 0.00040 0.01410 0.08395 0.510
mIshigami 0.79350 0.62960 0.48760 4.04035 1.090
mRef153 3.42575 11.73640 2.16255 15.17465 0.220
uDmod1 0.14440 0.02085 0.08440 0.51000 0.230
uDmod2 0.08465 0.00715 0.05725 0.24415 0.240
uDreyfus1 0.30825 0.09510 0.19510 0.94665 0.115
uDreyfus2 0.12580 0.01580 0.09280 0.29325 0.145
uGauss1 2.73215 7.46495 2.12470 8.70795 0.235
uGauss2 7.27225 54.16155 5.05260 21.32695 0.240
uGauss3 3.52450 12.42345 2.54595 11.80575 0.180
uNeuroOne 0.29390 0.08640 0.22580 0.72310 0.075