Description Usage Arguments Value Note Author(s) References See Also Examples
Computes the generalized cross-validation (gcv) score of a tuning parameter configuration given the data. The tuning parameters consists of dimension of the random Fourier transform (=D), the variance of the Gaussian kernels (=sigma) and the regularization parameter of the kernel ridge regression (=lambda). It is a wrapper around the function lossGCV
and therefore only supports the generalized cross-validation score. First a kernel deep stacking network is fitted. Then the inputs are prepared to calculate the gcv score.
1 2 3 4 5 6 |
parOpt |
The numeric parameter vector of the tuning parameters. The length of the vector is required to be divisible with three without rest. The order of the parameters is (D, sigma, lambda) in one level. Each additional level is added as new elements, e.g. with two levels (D_1, sigma_1, lambda_1, D_2, sigma_2, lambda_2), etc. |
y |
Numeric response vector of the outcome. Should be formated as a one column matrix. |
X |
Numeric design matrix of the covariates. All factors have to be prior encoded. |
levels |
Number of levels of the kernel deep stacking network (integer scalar). |
seedW |
Seeds for the random Fourier transformation (integer vector). Each value corresponds to the seed of one level. The length must equal the number of levels of the kernel deep stacking network. |
varSelect |
Should unimportant variables be excluded in each level? Default is that all available variables are used. (logical scalar) |
varRanking |
Defines a variable ranking in increasing order. The first variable is least important and the last is the most important. (integer vector) |
alpha |
Weight parameter between lasso and ridge penalty (numeric vector) of each level. Default=0 corresponds to ridge penalty and 1 equals lasso. |
dropHidden |
Should dropout be applied on the random Fourier transformation? Each entry corresponds to the one level. Default is without dropout (logical vector). |
seedDrop |
Specifies the seed of the random dropouts in the calculation of random Fourier transformation per level. Default is random (integer vector). |
standX |
Should the design matrix be standardized by median and median absolute deviation? Default is TRUE. |
standY |
Should the response be standardized by median and median absolute deviation? Default is FALSE. |
namesParOpt |
Gives the names of the argument parOpt (character vector). It is used to encode the parameters into the correct structure suitable in fitting the kernel deep stacking network. |
gammaPar |
Weighting parameter (numeric scalar), which specifies how the generalized cross-validation score is penalized by the effective degrees of freedom. Default value is 1. |
Numeric scalar with gives the generalized cross-validation score. The kernel deep stacking network used to calculate the score is available in the attributes.
This function is not intended to be called directly by the user. Should only be used by experienced users, who want to customize the model.
Thomas Welchowski welchow@imbie.meb.uni-bonn.de
Simon N. Wood, (2006), Generalized Additive Models: An Introduction with R, Taylor \& Francis Group LLC
lossCvKDSN
, lossGCV
, lossSharedCvKDSN
,
lossSharedTestKDSN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ####################################
# Example with simple binary outcome
# Generate covariate matrix
sampleSize <- 100
X <- matrix(0, nrow=100, ncol=10)
for(j in 1:10) {
set.seed (j)
X [, j] <- rnorm(sampleSize)
}
# Generate response of binary problem with sum(X) > 0 -> 1 and 0 elsewhere
# with Gaussian noise
set.seed(-1)
error <- rnorm (100)
y <- ifelse((rowSums(X) + error) > 0, 1, 0)
# Calculate loss function with parameters (D=10, sigma=1, lambda=0)
# in one layer
calcLoss <- lossApprox (parOpt=c(10, 1, 0), y=y, X=X,
levels=1, seedW=0)
str(calcLoss)
# Calculate loss function with parameters
# (D=10, sigma=1, lambda=0.1, D=5, sigma=2, lambda=0.01) in two layers
calcLoss <- lossApprox (parOpt=c(10, 1, 0.1, 5, 2, 0.01),
y=y, X=X, levels=1, seedW=0)
str(calcLoss)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.