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 MachineShop trainPredict arguments - inputs fmla, data

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

2 Launch package’s trainPredict

res <- trainPredict_1pkg(1:12, pkgname = "MachineShop", pkgfun = "fit", MachineShop.method,
  prepareZZ.arg = MachineShop.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.3019 0.0912 0.2322 1.2867 0.07
mFriedman 0.0118 0.0001 0.0093 0.0359 0.08
mIshigami 0.5946 0.3536 0.4553 2.6373 0.14
mRef153 3.1128 9.6892 2.1804 11.7425 0.01
uDmod1 0.0438 0.0019 0.0353 0.1157 0.01
uDmod2 0.0429 0.0018 0.0342 0.1056 0.00
uDreyfus1 0.0017 0.0000 0.0013 0.0051 0.00
uDreyfus2 0.0906 0.0082 0.0724 0.2196 0.01
uGauss1 2.2373 5.0057 1.7396 6.9809 0.03
uGauss2 2.3754 5.6426 1.8697 7.6227 0.03
uGauss3 2.8198 7.9512 2.2059 7.6890 0.03
uNeuroOne 0.2830 0.0801 0.2313 0.5675 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.48575 0.23610 0.36050 2.11030 0.085
mFriedman 0.02635 0.00075 0.02115 0.08195 0.100
mIshigami 0.74250 0.55420 0.55380 3.14845 0.160
mRef153 3.26040 10.63145 2.25895 13.99795 0.020
uDmod1 0.06545 0.00470 0.04950 0.19400 0.015
uDmod2 0.06050 0.00365 0.04790 0.13035 0.010
uDreyfus1 0.00230 0.00000 0.00180 0.00730 0.010
uDreyfus2 0.09065 0.00820 0.07250 0.22070 0.010
uGauss1 2.59080 6.71650 2.04905 8.41850 0.030
uGauss2 2.79355 7.85105 2.23895 8.85435 0.030
uGauss3 3.18900 10.17025 2.51305 9.85535 0.030
uNeuroOne 0.28300 0.08010 0.23130 0.56750 0.000