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
deepdive 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(deepdive)
deepdive.method <- c("gradientDescent","momentum","rmsProp","adam")
hyperParams.deepdive <- function(optim_method, ...) {
if (optim_method == "gradientDescent") {maxiter <- maxit1storderB; eta = 0.4}
if (optim_method == "momentum") {maxiter <- maxit1storderB; eta = 0.8}
if (optim_method == "rmsProp") {maxiter <- maxit1storderA; eta = 0.8}
if (optim_method == "adam") {maxiter <- maxit1storderA; eta = 0.8}
out <- list(iter = maxiter, method = optim_method, modelType = "regress", eta = eta, print = 1000)
return (out)
}
NNtrain.deepdive <- function(x, y, dataxy, formula, neur, optim_method, hyperParams, NNfullformula, NNparam,...) {
hyper_params <- do.call(hyperParams, list(optim_method, ...))
NNreg <- deepdive::deepnet(x = x, y = y, c(neur), modelType = hyper_params$modelType,
iterations = hyper_params$iter, eta=hyper_params$eta,
optimiser=hyper_params$method, printItrSize=hyper_params$print,
normalise = FALSE)
return (NNreg)
}
NNpredict.deepdive <- function(object, x, ...)
predict.deepnet(object,newData=x)$ypred
NNclose.deepdive <- function()
if("package:deepdive" %in% search())
detach("package:deepdive", unload=TRUE)
deepdive.prepareZZ <- list(xdmv = "d", ydmv = "d", zdm = "d", scale = TRUE)
if(FALSE)
res <- trainPredict_1data(1, deepdive.method, "NNtrain.deepdive", "hyperParams.deepdive", "NNpredict.deepdive",
NNsummary, "NNclose.deepdive", NA, deepdive.prepareZZ, nrep=5, echo=TRUE, doplot=FALSE,
pkgname="deepdive", pkgfun="ann", csvfile=TRUE, rdafile=TRUE, odir=odir)
Launch package’s trainPredict
res <- trainPredict_1pkg(1:12, pkgname = "deepdive", pkgfun = "deepnet", deepdive.method,
prepareZZ.arg = deepdive.prepareZZ, nrep = nrep, doplot = FALSE,
csvfile = TRUE, rdafile = TRUE, odir = odir, echo = FALSE)
Results
kable(apply(res[,,1,], c(3,1), min), caption = "gradientDescent")%>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
gradientDescent
|
RMSE
|
MSE
|
MAE
|
WAE
|
time
|
mDette
|
4.4310
|
19.6338
|
3.2628
|
20.7622
|
7.27
|
mFriedman
|
0.1474
|
0.0217
|
0.1154
|
0.4581
|
7.74
|
mIshigami
|
3.0218
|
9.1314
|
2.4940
|
10.2360
|
9.07
|
mRef153
|
4.1805
|
17.4764
|
3.1843
|
14.4946
|
5.91
|
uDmod1
|
0.3353
|
0.1124
|
0.2912
|
0.7067
|
5.33
|
uDmod2
|
0.2699
|
0.0729
|
0.2369
|
0.5509
|
5.30
|
uDreyfus1
|
0.3429
|
0.1176
|
0.2801
|
0.7346
|
5.22
|
uDreyfus2
|
0.3570
|
0.1275
|
0.2905
|
0.8478
|
5.19
|
uGauss1
|
23.6597
|
559.7792
|
19.1988
|
57.7174
|
6.05
|
uGauss2
|
28.8118
|
830.1176
|
25.1770
|
67.7823
|
5.95
|
uGauss3
|
32.2441
|
1039.6844
|
27.7063
|
70.1972
|
5.93
|
uNeuroOne
|
0.3666
|
0.1344
|
0.3105
|
0.6748
|
5.15
|
kable(apply(res[,,2,], c(3,1), min), caption = "momentum")%>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
momentum
|
RMSE
|
MSE
|
MAE
|
WAE
|
time
|
mDette
|
4.1990
|
17.6313
|
3.1011
|
18.5512
|
7.39
|
mFriedman
|
0.1363
|
0.0186
|
0.1061
|
0.4860
|
8.00
|
mIshigami
|
2.5791
|
6.6519
|
2.0107
|
8.7569
|
9.11
|
mRef153
|
3.8424
|
14.7643
|
2.7879
|
15.0474
|
6.11
|
uDmod1
|
0.3320
|
0.1103
|
0.2891
|
0.7441
|
5.57
|
uDmod2
|
0.2656
|
0.0705
|
0.2355
|
0.5269
|
5.48
|
uDreyfus1
|
0.3429
|
0.1176
|
0.2801
|
0.7341
|
5.49
|
uDreyfus2
|
0.3570
|
0.1275
|
0.2907
|
0.8468
|
5.39
|
uGauss1
|
16.2557
|
264.2462
|
13.0878
|
49.2409
|
6.23
|
uGauss2
|
28.8104
|
830.0390
|
25.1756
|
67.8020
|
6.17
|
uGauss3
|
32.2413
|
1039.4994
|
27.7055
|
70.2077
|
6.18
|
uNeuroOne
|
0.3544
|
0.1256
|
0.3001
|
0.6152
|
5.39
|
kable(apply(res[,,3,], c(3,1), min), caption = "rmsProp")%>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
rmsProp
|
RMSE
|
MSE
|
MAE
|
WAE
|
time
|
mDette
|
2.7205
|
7.4011
|
1.8705
|
16.1780
|
0.75
|
mFriedman
|
0.1287
|
0.0166
|
0.0990
|
0.4133
|
0.78
|
mIshigami
|
2.6728
|
7.1439
|
2.3060
|
7.1452
|
0.87
|
mRef153
|
4.0384
|
16.3091
|
3.0290
|
15.7099
|
0.62
|
uDmod1
|
0.1728
|
0.0299
|
0.1257
|
0.4478
|
0.56
|
uDmod2
|
0.2252
|
0.0507
|
0.1580
|
0.5513
|
0.55
|
uDreyfus1
|
0.1184
|
0.0140
|
0.0878
|
0.3446
|
0.54
|
uDreyfus2
|
0.1625
|
0.0264
|
0.1232
|
0.4839
|
0.54
|
uGauss1
|
23.5833
|
556.1721
|
19.1113
|
57.9958
|
0.64
|
uGauss2
|
18.3426
|
336.4509
|
12.6957
|
49.5614
|
0.61
|
uGauss3
|
20.7977
|
432.5437
|
15.4531
|
49.0396
|
0.62
|
uNeuroOne
|
0.3161
|
0.0999
|
0.2695
|
0.5981
|
0.55
|
kable(apply(res[,,4,], c(3,1), min), caption = "adam")%>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
adam
|
RMSE
|
MSE
|
MAE
|
WAE
|
time
|
mDette
|
3.0971
|
9.5922
|
2.0640
|
18.6373
|
0.74
|
mFriedman
|
0.0875
|
0.0077
|
0.0764
|
0.2699
|
0.78
|
mIshigami
|
2.5913
|
6.7150
|
2.0819
|
10.0604
|
0.88
|
mRef153
|
3.7605
|
14.1414
|
2.6651
|
15.3279
|
0.64
|
uDmod1
|
0.1178
|
0.0139
|
0.0797
|
0.4868
|
0.57
|
uDmod2
|
0.3189
|
0.1017
|
0.2113
|
0.7209
|
0.56
|
uDreyfus1
|
0.0304
|
0.0009
|
0.0265
|
0.0644
|
0.56
|
uDreyfus2
|
0.1149
|
0.0132
|
0.0907
|
0.2749
|
0.54
|
uGauss1
|
20.5179
|
420.9855
|
16.5474
|
47.6354
|
0.62
|
uGauss2
|
16.8843
|
285.0805
|
11.6361
|
46.6218
|
0.61
|
uGauss3
|
10.0466
|
100.9345
|
7.3484
|
31.6838
|
0.61
|
uNeuroOne
|
0.2946
|
0.0868
|
0.2459
|
0.5582
|
0.56
|