library(NNbenchmark)
library(kableExtra)
options(scipen = 999)
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
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(nlsr)
nlsr.method <- "none"
hyperParams.nlsr <- function(...) {
return (list(iter = maxit2ndorder, sdnormstart = 0.1))
}
NNtrain.nlsr <- function(x, y, dataxy, formula, neur, method, hyperParams, NNfullformula, NNparam, ...) {
hyper_params <- do.call(hyperParams, list(...))
start <- round(rnorm(NNparam, sd = hyper_params$sdnormstart), 4)
names(start) <- paste0("b", 1:NNparam)
NNreg <- nlsr::nlxb(NNfullformula, data = dataxy, start = start, control = list(femax = hyper_params$iter))
return(NNreg)
}
NNpredict.nlsr <- function(object, x, ...)
as.numeric(predict(object, x))
NNclose.nlsr <- function()
if("package:nlsr" %in% search())
detach("package:nlsr", unload=TRUE)
nlsr.prepareZZ <- list(xdmv = "d", ydmv = "v", zdm = "d", scale = TRUE)
if(FALSE)
res <- trainPredict_1data(1, nlsr.method, "NNtrain.nlsr", "hyperParams.nlsr", "NNpredict.nlsr",
NNsummary, "NNclose.nlsr", NA, nlsr.prepareZZ, nrep=5,
echo=TRUE, doplot=FALSE, echoreport=0,
pkgname="nlsr", pkgfun="nlxb", csvfile=TRUE, rdafile=TRUE, odir=odir)
res <- trainPredict_1pkg(1:12, pkgname = "nlsr", pkgfun = "nlxb", nlsr.method,
prepareZZ.arg = nlsr.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.1331 | 0.0177 | 0.1069 | 0.6221 | 0.39 |
mFriedman | 0.0043 | 0.0000 | 0.0035 | 0.0127 | 0.62 |
mIshigami | 0.5859 | 0.3433 | 0.4563 | 2.2560 | 1.17 |
mRef153 | 3.2246 | 10.3983 | 2.1894 | 11.5242 | 0.15 |
uDmod1 | 0.0405 | 0.0016 | 0.0311 | 0.1045 | 0.09 |
uDmod2 | 0.0427 | 0.0018 | 0.0333 | 0.1058 | 0.05 |
uDreyfus1 | 0.0000 | 0.0000 | 0.0000 | 0.0001 | 0.00 |
uDreyfus2 | 0.0906 | 0.0082 | 0.0723 | 0.2197 | 0.02 |
uGauss1 | 2.2323 | 4.9831 | 1.7377 | 6.9354 | 0.07 |
uGauss2 | 2.3330 | 5.4430 | 1.8305 | 7.3282 | 0.04 |
uGauss3 | 2.2991 | 5.2860 | 1.8377 | 7.0771 | 0.03 |
uNeuroOne | 0.2830 | 0.0801 | 0.2313 | 0.5675 | 0.00 |
kable(t(apply(res, c(1,4), median)))%>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
RMSE | MSE | MAE | WAE | time | |
---|---|---|---|---|---|
mDette | 1.05550 | 1.17675 | 0.87970 | 3.49245 | 0.410 |
mFriedman | 0.00550 | 0.00000 | 0.00435 | 0.01860 | 0.645 |
mIshigami | 1.95595 | 3.82580 | 1.49170 | 5.36155 | 1.220 |
mRef153 | 3.62380 | 13.13395 | 2.60045 | 14.91630 | 0.160 |
uDmod1 | 0.04555 | 0.00205 | 0.03650 | 0.11935 | 0.095 |
uDmod2 | 0.06255 | 0.00395 | 0.04985 | 0.14455 | 0.080 |
uDreyfus1 | 0.00000 | 0.00000 | 0.00000 | 0.00010 | 0.020 |
uDreyfus2 | 0.09060 | 0.00820 | 0.07230 | 0.21970 | 0.060 |
uGauss1 | 2.77100 | 7.88405 | 2.07335 | 10.27100 | 0.150 |
uGauss2 | 3.74180 | 14.05915 | 2.79805 | 13.75795 | 0.110 |
uGauss3 | 2.81850 | 7.94390 | 2.20780 | 7.50770 | 0.080 |
uNeuroOne | 0.28300 | 0.08010 | 0.23130 | 0.56750 | 0.020 |