Setup
Packages and options
library(NNbenchmark)
library(kableExtra)
options(scipen = 999)
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
ELMR Train Function - arguments formula, 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
ELMR.method <- "extremeML"
hyperParams.ELMR <- function(optim_method, ...) {
hidden_activation <- "sig"
size_first_block <- 50
size_each_chunk <- 50
out <- list(hidden_activation = hidden_activation,
size_first_block=size_first_block, size_each_chunk=size_each_chunk)
return (out)
}
NNtrain.ELMR <- function(x, y, dataxy, formula, hidden_neur, optim_method, hyperParams, ...) {
hyper_params <- do.call(hyperParams, list(optim_method, ...))
hidden_activation <- hyper_params$hidden_activation
size_each_chunk <- hyper_params$size_each_chunk
size_first_block <- hyper_params$size_first_block
#OSelm_train.formula() call OSelm_training()
NNreg <- ELMR::OSelm_train.formula(formula = formula,
data = dataxy,
Elm_type = "regression",
nHiddenNeurons = hidden_neur,
ActivationFunction = hidden_activation,
N0 = size_first_block, Block = size_each_chunk)
return (NNreg)
}
NNpredict.ELMR <- function(object, x, xy)
ELMR::predict_elm(model = object, test = xy)$predicted
NNclose.ELMR <- function()
if("package:ELMR" %in% search())
detach("package:ELMR", unload=TRUE)
ELMR.prepareZZ <- list(xdmv = "m", ydmv = "m", zdm = "d", scale = TRUE)
if(FALSE)
res <- train_and_predict_1data(1, ELMR.method, "NNtrain.ELMR", "hyperParams.ELMR", "NNpredict.ELMR",
NNsummary, "NNclose.ELMR", NA, ELMR.prepareZZ, nrep=2, echo=TRUE, doplot=FALSE,
pkgname="ELMR", pkgfun="OSelm_train", rdafile=TRUE, odir=odir)
Launch package’s trainPredict
res <- trainPredict_1pkg(1:12, pkgname = "ELMR", pkgfun = "OSelm_train.formula", ELMR.method,
prepareZZ.arg = ELMR.prepareZZ, nrep = nrep, doplot = TRUE,
csvfile = TRUE, rdafile = TRUE, odir = odir, echo = FALSE)
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.8979
|
47.5806
|
5.6315
|
27.3255
|
0.01
|
mFriedman
|
0.1481
|
0.0219
|
0.1160
|
0.4587
|
0.00
|
mIshigami
|
3.0365
|
9.2201
|
2.5408
|
9.8415
|
0.00
|
mRef153
|
13.3990
|
179.5343
|
10.8774
|
34.5165
|
0.00
|
uDmod1
|
0.3024
|
0.0914
|
0.2476
|
0.8167
|
0.00
|
uDmod2
|
0.2547
|
0.0648
|
0.2272
|
0.4618
|
0.00
|
uDreyfus1
|
0.4198
|
0.1763
|
0.2751
|
1.0798
|
0.00
|
uDreyfus2
|
0.4255
|
0.1811
|
0.2921
|
1.1807
|
0.00
|
uGauss1
|
264.7452
|
70090.0432
|
220.2319
|
778.6982
|
0.00
|
uGauss2
|
24.8924
|
619.6336
|
21.4221
|
52.3001
|
0.00
|
uGauss3
|
26.5430
|
704.5322
|
22.7605
|
54.2973
|
0.00
|
uNeuroOne
|
0.9856
|
0.9714
|
0.8251
|
2.2928
|
0.00
|
kable(t(apply(res, c(1,4), median)))%>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
|
RMSE
|
MSE
|
MAE
|
WAE
|
time
|
mDette
|
7.36045
|
54.17690
|
5.86395
|
31.06885
|
0.015
|
mFriedman
|
0.16980
|
0.02880
|
0.13480
|
0.52295
|
0.020
|
mIshigami
|
3.26795
|
10.67975
|
2.64755
|
11.60160
|
0.010
|
mRef153
|
17.87730
|
319.60330
|
14.11365
|
49.46080
|
0.005
|
uDmod1
|
0.31340
|
0.09825
|
0.26215
|
0.85120
|
0.000
|
uDmod2
|
0.27525
|
0.07575
|
0.23940
|
0.54245
|
0.000
|
uDreyfus1
|
0.44615
|
0.19900
|
0.29940
|
1.15540
|
0.000
|
uDreyfus2
|
0.44995
|
0.20250
|
0.30180
|
1.29725
|
0.000
|
uGauss1
|
1494.00805
|
2391350.56325
|
1300.09800
|
3880.74920
|
0.010
|
uGauss2
|
72.79175
|
5351.86480
|
61.48805
|
194.53205
|
0.000
|
uGauss3
|
42.16685
|
1801.73205
|
34.10520
|
114.33340
|
0.000
|
uNeuroOne
|
1.03080
|
1.06260
|
0.84910
|
2.45055
|
0.000
|