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 elmNNRcpp Train Function - arguments 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(elmNNRcpp)
elmNNRcpp.method <- "extremeML"
hyperParams.elmNNRcpp <- function(optim_method, ...) {
    
    moorep_pseudoinv_tol <- 0.01
    wt_init <- "normal_gaussian"
    hidden_activation <- "tansig"
    
    out <- list(wt_init = wt_init, hidden_activation = hidden_activation, 
                moorep_pseudoinv_tol=moorep_pseudoinv_tol) 
    return (out)
}
NNtrain.elmNNRcpp <- function(x, y, dataxy, formula, hidden_neur, optim_method, hyperParams, ...) {
    
    hyper_params <- do.call(hyperParams, list(optim_method, ...))
    
    wt_init <- hyper_params$wt_init
    hidden_activation <- hyper_params$hidden_activation
    moorep_pseudoinv_tol <- hyper_params$moorep_pseudoinv_tol

    NNreg <- elmNNRcpp::elm_train(x, y, 
                                  nhid = hidden_neur, 
                                  actfun=hidden_activation, 
                                  init_weights = wt_init, 
                                  bias = TRUE, 
                                  moorep_pseudoinv_tol = moorep_pseudoinv_tol, 
                                  verbose = FALSE,
                                  seed = as.integer(runif(1)*10000000))
    return (NNreg)
}
NNpredict.elmNNRcpp <- function(object, x, ...)
    elmNNRcpp::elm_predict(elm_train_object = object, newdata = x, normalize = FALSE)
NNclose.elmNNRcpp <- function()
  if("package:elmNNRcpp" %in% search())
    detach("package:elmNNRcpp", unload=TRUE)
elmNNRcpp.prepareZZ <- list(xdmv = "m", ydmv = "m", zdm = "d", scale = TRUE)
if(FALSE)
res <- train_and_predict_1data(1, elmNNRcpp.method, "NNtrain.elmNNRcpp", "hyperParams.elmNNRcpp", "NNpredict.elmNNRcpp", 
                               NNsummary, "NNclose.elmNNRcpp", NA, elmNNRcpp.prepareZZ, nrep=2, echo=TRUE, doplot=FALSE,
                               pkgname="elmNNRcpp", pkgfun="elm_train", rdafile=TRUE, odir=odir)

2 Launch package’s trainPredict

res <- trainPredict_1pkg(1:12, pkgname = "elmNNRcpp", pkgfun = "elm_train", elmNNRcpp.method,
  prepareZZ.arg = elmNNRcpp.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 6.7431 45.4690 5.3290 28.3835 0
mFriedman 0.1512 0.0229 0.1172 0.5130 0
mIshigami 3.0283 9.1708 2.5119 10.1756 0
mRef153 13.0754 170.9665 10.7021 30.0043 0
uDmod1 0.2678 0.0717 0.2177 0.5856 0
uDmod2 0.2458 0.0604 0.2054 0.4470 0
uDreyfus1 0.3861 0.1491 0.2810 0.9478 0
uDreyfus2 0.3918 0.1535 0.2763 1.1060 0
uGauss1 15.7879 249.2584 13.4594 35.1278 0
uGauss2 14.3522 205.9860 11.8107 29.2876 0
uGauss3 11.5393 133.1555 9.0697 28.5195 0
uNeuroOne 0.9054 0.8197 0.7074 2.0337 0
kable(t(apply(res, c(1,4), median)))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
RMSE MSE MAE WAE time
mDette 7.55675 57.10480 6.00285 31.31350 0
mFriedman 0.17370 0.03020 0.13785 0.55525 0
mIshigami 3.23750 10.48145 2.63845 11.00755 0
mRef153 18.87650 357.29060 15.50660 47.60480 0
uDmod1 0.33295 0.11080 0.28725 0.76320 0
uDmod2 0.27215 0.07410 0.23840 0.52830 0
uDreyfus1 0.61055 0.37385 0.46940 1.32570 0
uDreyfus2 0.50180 0.25240 0.37055 1.22020 0
uGauss1 23.54305 554.42470 19.72120 55.96205 0
uGauss2 18.07710 328.74100 15.33640 39.31310 0
uGauss3 22.75650 518.56870 19.70470 45.35075 0
uNeuroOne 0.99020 0.98100 0.81130 2.28060 0