A validation set based stop criterion for TrainIBHM function creating IBHM approximation models. Should be passed to ConfigureIBHMwhile creating a configuration object.
Usage
ValidationSC(x, y)
Arguments
x
Validation set input arguments, should be convertible to a matrix.
y
Validation set predicted argument, should be convertible to a single column matrix.
Details
The criterion is checked after each iteration and the current model is used to predict values on the validation data set. When the error increases in comparison to the previous iteration,
the construction process is stopped, and the changes in the model from the last iteration are undone.
See Also
IterationSC,ConfigureIBHM, TrainIBHM
Examples
# Training data
x <- seq(-3,3,length.out=400)
y <- tanh(x)
# A held out validation set for the stop criterion
x.val <- runif(50,min=-6,max=6)
y.val <- tanh(x.val)
# Training the model using the validation set to prevent overfitting
m <- TrainIBHM(x,y,
ConfigureIBHM(stop.criterion = ValidationSC(x.val, y.val))
)
summary(m)
plot(y.val,predict(m,x.val),asp=1)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(IBHM)
Loading required package: compiler
Loading required package: DEoptim
DEoptim package
Differential Evolution algorithm in R
Authors: D. Ardia, K. Mullen, B. Peterson and J. Ulrich
Loading required package: cmaes
Loading required package: Rcpp
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/IBHM/ValidationSC.Rd_%03d_medium.png", width=480, height=480)
> ### Name: ValidationSC
> ### Title: ValidationSC
> ### Aliases: ValidationSC
> ### Keywords: ~models ~regression ~nonlinear
>
> ### ** Examples
>
> # Training data
> x <- seq(-3,3,length.out=400)
> y <- tanh(x)
>
> # A held out validation set for the stop criterion
> x.val <- runif(50,min=-6,max=6)
> y.val <- tanh(x.val)
>
>
> # Training the model using the validation set to prevent overfitting
> m <- TrainIBHM(x,y,
+ ConfigureIBHM(stop.criterion = ValidationSC(x.val, y.val))
+ )
Note: no visible binding for global variable '.refClassDef'
Note: no visible binding for global variable '.refClassDef'
Note: no visible binding for global variable '.pointer'
Note: no visible binding for global variable '.pointer'
Note: no visible binding for global variable '.pointer'
>
> summary(m)
Model equation: 1.00e+00 -3.79e-04 logsig ( -1.00e+00 * dot.pr (x,[ 2.93e+00 -7.79e-01 ]) + 3.06e+00 ) -2.00e+00 logsig ( 8.67e-01 * dot.pr (x,[ -2.95e+00 2.31e+00 ]) + 2.56e+00 )
Model size: 2
Train set dim: 1 Train set size: 400
MSE: 3.37951e-11 Std. dev:
RMSE: 5.813355e-06
Pearson correlation coefficient: 1
> plot(y.val,predict(m,x.val),asp=1)
>
>
>
>
>
> dev.off()
null device
1
>
Note: no visible binding for global variable '.pointer'