library(NNbenchmark)
library(kableExtra)
options(scipen = 999)
if(dir.exists("D:/GSoC2020/Results/"))
{
odir <- "D:/GSoC2020/Results/"
}else if(dir.exists("~/Documents/recherche-enseignement/code/R/NNbenchmark-project/NNtempresult/"))
{
odir <- "~/Documents/recherche-enseignement/code/R/NNbenchmark-project/NNtempresult/"
}else
odir <- "~"
nrep <- 5
maxit2ndorder <- 200
maxit1storderA <- 1000
maxit1storderB <- 5000
maxit1storderC <- 10000
maxit1storderD <- 100000
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
#library(BNN)
BNN.method <- "none"
hyperParams.BNN <- function(optim_method, ...) {
return(list(iter = maxit1storderD, popN = 10, nCPUs = 10))
}
NNtrain.BNN <- function(x, y, dataxy, formula, neur, optim_method, hyperParams,...) {
hyper_params <- do.call(hyperParams.BNN, list(BNN.method, ...))
NNreg <- BNN::BNNsel(X = x,Y = y,hid_num = neur,train_num = (nrow(dataxy)-1),
total_iteration = hyper_params$iter, popN = hyper_params$popN,
nCPUs = hyper_params$nCPUs)
return (NNreg)
}
NNpredict.BNN <- function(object, x, ...)
c(object$fit, object$pred)
NNclose.BNN <- function()
if("package:BNN" %in% search())
detach("package:BNN", unload=TRUE)
BNN.prepareZZ <- list(xdmv = "m", ydmv = "v", zdm = "d", scale = TRUE)
if(FALSE)
res <- trainPredict_1data(1, BNN.method, "NNtrain.BNN", "hyperParams.BNN", "NNpredict.BNN",
NNsummary, "NNclose.BNN", NA, BNN.prepareZZ, nrep=5, echo=TRUE, doplot=FALSE,
pkgname="BNN", pkgfun="BNN", csvfile=TRUE, rdafile=TRUE, odir=odir)
if(FALSE)
res <- trainPredict_1mth1data(1, BNN.method[1], "NNtrain.BNN", "hyperParams.BNN", "NNpredict.BNN",
NNsummary, BNN.prepareZZ, nrep=5, echo=TRUE, doplot=FALSE,
pkgname="BNN", pkgfun="BNN", csvfile=TRUE, rdafile=TRUE, odir=odir)
res <- trainPredict_1pkg(1:2, pkgname = "BNN", pkgfun = "BNNsel", BNN.method,
prepareZZ.arg = BNN.prepareZZ, nrep = nrep, doplot = TRUE,
csvfile = TRUE, rdafile = TRUE, odir = odir, echo = FALSE)
#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.9358 | 0.8757 | 0.7527 | 3.6542 | 21.95 |
mFriedman | 0.0294 | 0.0009 | 0.0228 | 0.0841 | 25.38 |
mIshigami | 1.6159 | 2.6112 | 1.1502 | 5.5863 | 22.84 |
mRef153 | 4.2381 | 17.9614 | 3.1880 | 14.2094 | 9.67 |
uDmod1 | 0.3700 | 0.1369 | 0.2988 | 0.9969 | 7.80 |
uDmod2 | 0.2968 | 0.0881 | 0.2527 | 0.6157 | 7.75 |
uDreyfus1 | 0.0122 | 0.0001 | 0.0097 | 0.0376 | 7.77 |
uDreyfus2 | 0.0950 | 0.0090 | 0.0730 | 0.2328 | 7.67 |
uGauss1 | 10.4421 | 109.0369 | 8.5235 | 28.9261 | 12.33 |
uGauss2 | 6.2237 | 38.7339 | 4.9376 | 16.5715 | 12.04 |
uGauss3 | 3.5014 | 12.2595 | 2.7198 | 10.1987 | 12.62 |
uNeuroOne | 0.3405 | 0.1159 | 0.2831 | 0.7512 | 7.69 |
kable(t(apply(res, c(1,4), median)))%>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
RMSE | MSE | MAE | WAE | time | |
---|---|---|---|---|---|
mDette | 1.2636 | 1.5968 | 0.9405 | 6.8995 | 23.67 |
mFriedman | 0.0320 | 0.0010 | 0.0260 | 0.0885 | 26.31 |
mIshigami | 2.5337 | 6.4198 | 2.1835 | 6.6712 | 26.61 |
mRef153 | 4.2940 | 18.4383 | 3.2814 | 14.4490 | 10.15 |
uDmod1 | 0.3709 | 0.1376 | 0.2998 | 0.9979 | 7.82 |
uDmod2 | 0.2972 | 0.0884 | 0.2531 | 0.6169 | 7.80 |
uDreyfus1 | 0.0226 | 0.0005 | 0.0200 | 0.0542 | 7.85 |
uDreyfus2 | 0.1069 | 0.0114 | 0.0840 | 0.2642 | 7.80 |
uGauss1 | 10.4803 | 109.8361 | 8.5672 | 29.4434 | 12.64 |
uGauss2 | 7.1107 | 50.5615 | 4.9682 | 22.2460 | 12.26 |
uGauss3 | 3.8620 | 14.9154 | 2.9733 | 12.0896 | 12.97 |
uNeuroOne | 0.3699 | 0.1368 | 0.3075 | 0.7961 | 7.74 |