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
EnsembleBase 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(EnsembleBase)
EnsembleBase.method <- "none"
hyperParams.EnsembleBase <- function(optim_method, ...) {
out <- list(iter = maxit2ndorder, decay = 0)
return (out)
}
NNtrain.EnsembleBase <- function(x, y, dataxy, formula, neur, optim_method, hyperParams,...) {
hyper_params <- do.call(hyperParams.EnsembleBase, list(EnsembleBase.method))
iter <- hyper_params$iter ; decay <- hyper_params$decay
NNreg <- EnsembleBase::Regression.Batch.Fit(make.configs("nnet", config.df = expand.grid(decay=decay,size=c(neur),maxit=iter)), formula, dataxy, ncores = 1)
return (NNreg)
}
NNpredict.EnsembleBase <- function(object, x, ...)
predict(object, x)
NNclose.EnsembleBase <- function()
if("package:EnsembleBase" %in% search())
detach("package:EnsembleBase", unload=TRUE)
EnsembleBase.prepareZZ <- list(xdmv = "m", ydmv = "v", zdm = "d", scale = TRUE)
if(FALSE)
res <- trainPredict_1data(1, EnsembleBase.method, "NNtrain.EnsembleBase", "hyperParams.EnsembleBase", "NNpredict.EnsembleBase",
NNsummary, "NNclose.EnsembleBase", NA, EnsembleBase.prepareZZ, nrep=5, echo=TRUE, doplot=FALSE,
pkgname="EnsembleBase", pkgfun="EnsembleBase", csvfile=TRUE, rdafile=TRUE, odir=odir)
if(FALSE)
res <- trainPredict_1mth1data(1, EnsembleBase.method[1], "NNtrain.EnsembleBase", "hyperParams.EnsembleBase", "NNpredict.EnsembleBase",
NNsummary, EnsembleBase.prepareZZ, nrep=5, echo=TRUE, doplot=FALSE,
pkgname="EnsembleBase", pkgfun="EnsembleBase", csvfile=TRUE, rdafile=TRUE, odir=odir)
Launch package’s trainPredict
res <- trainPredict_1pkg(1:12, pkgname = "EnsembleBase", pkgfun = "Regression.Batch.Fit", EnsembleBase.method,
prepareZZ.arg = EnsembleBase.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
|
0.9162
|
0.8395
|
0.7103
|
4.3568
|
0.00
|
mFriedman
|
0.0251
|
0.0006
|
0.0164
|
0.1314
|
0.08
|
mIshigami
|
0.6717
|
0.4512
|
0.4711
|
3.6055
|
0.12
|
mRef153
|
3.4497
|
11.9005
|
2.4704
|
13.5906
|
0.01
|
uDmod1
|
0.0541
|
0.0029
|
0.0418
|
0.1344
|
0.00
|
uDmod2
|
0.0437
|
0.0019
|
0.0336
|
0.0947
|
0.00
|
uDreyfus1
|
0.0930
|
0.0086
|
0.0541
|
0.3124
|
0.00
|
uDreyfus2
|
0.1143
|
0.0131
|
0.0903
|
0.2712
|
0.01
|
uGauss1
|
2.5238
|
6.3698
|
1.9769
|
7.3391
|
0.03
|
uGauss2
|
2.6861
|
7.2151
|
2.0962
|
9.5462
|
0.03
|
uGauss3
|
2.3783
|
5.6563
|
1.8641
|
7.6236
|
0.03
|
uNeuroOne
|
0.2829
|
0.0800
|
0.2318
|
0.5451
|
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.50495
|
97.76770
|
6.08405
|
26.30515
|
0.045
|
mFriedman
|
0.08125
|
0.00660
|
0.07255
|
0.18625
|
0.100
|
mIshigami
|
0.76470
|
0.58490
|
0.55145
|
3.82765
|
0.140
|
mRef153
|
3.73045
|
13.91750
|
2.68875
|
13.80425
|
0.020
|
uDmod1
|
0.06385
|
0.00405
|
0.04870
|
0.21480
|
0.010
|
uDmod2
|
0.06155
|
0.00380
|
0.04715
|
0.15210
|
0.010
|
uDreyfus1
|
0.10550
|
0.01125
|
0.06355
|
0.33680
|
0.000
|
uDreyfus2
|
0.14470
|
0.02095
|
0.10595
|
0.44615
|
0.020
|
uGauss1
|
2.76240
|
7.63095
|
2.14620
|
8.15580
|
0.030
|
uGauss2
|
3.14015
|
9.88260
|
2.50995
|
9.94470
|
0.030
|
uGauss3
|
3.72775
|
13.89630
|
2.76485
|
12.45400
|
0.030
|
uNeuroOne
|
0.28345
|
0.08035
|
0.23355
|
0.54985
|
0.000
|