Package 'RKHSMetaMod'

Title: Ridge Group Sparse Optimization Problem for Estimation of a Meta Model Based on Reproducing Kernel Hilbert Spaces
Description: Estimates the Hoeffding decomposition of an unknown function by solving ridge group sparse optimization problem based on reproducing kernel Hilbert spaces, and approximates its sensitivity indices (see Kamari, H., Huet, S. and Taupin, M.-L. (2019) <arXiv:1905.13695>).
Authors: Halaleh Kamari
Maintainer: Halaleh Kamari <[email protected]>
License: GPL (>= 2)
Version: 1.1
Built: 2024-11-03 06:44:41 UTC
Source: CRAN

Help Index


Set of Rcpp and R functions to produce a sequence of meta models that are the solutions of the RKHS Ridge Group Sparse or RKHS Group Lasso optimization problems, calulate their associated prediction errors as well as their empirical sensitivity indices.

Description

Fits a meta model to an unknown model mm by solving the ridge group sparse (or group lasso) optimization problem based on the reproducing kernel Hilbert spaces (RKHS), for the Gaussian regression model :

Y=m(X)+σε,Y=m(X)+\sigma\varepsilon,

where variables X1,...,XdX_{1},...,X_{d} are independent and uniformly distributed on [0,1][0,1] and are independent of ε\varepsilon's.

We define the ridge group sparse criteria by :

C(f0,θ)=Yf0InvPKvθv2+nγvPKvθv+nμvPKv1/2θv,C(f_{0},\theta)=\Vert Y-f_{0}I_{n}-\sum_{v\in\mathcal{P}}K_{v}\theta_{v}\Vert ^2+\sqrt{n}\gamma\sum_{v\in\mathcal{P}}\Vert K_v\theta_{v}\Vert +n\mu\sum_{v\in\mathcal{P}}\Vert K_{v}^{1/2}\theta_{v}\Vert,

and the group lasso criteria is obtained by setting γ=0\gamma=0 in the criteria above. We set μg=nμ\mu_g=\sqrt{n}\mu to be the group lasso penalty parameter.

For each pair of the penalty parameters (μ,γ)(\mu,\gamma) in the ridge group sparse criteria, one meta model, called RKHS meta model, is calculated. The RKHS meta model is an additive model with at most vMax groups. It satisfies the properties of the Hoeffding decomposition, and its terms estimate the terms in the Hoeffding decomposition of the function mm.

These estimators are evaluated using a testing dataset. That is, the prediction error is calculated for each RKHS meta model and the one with the minimum prediction error is the "best" estimator for the true model mm. It provides a function that estimates the empirical sensitivity indices of the "best" RKHS meta model as an approximation of the true sensitivity indices.

Details

Details.

Author(s)

Halaleh Kamari.

Maintainer: [email protected]

References

Kamari, H., Huet, S. and Taupin, M.-L. (2019) RKHSMetaMod : An R package to estimate the Hoeffding decomposition of an unknown function by solving RKHS Ridge Group Sparse optimization problem. <arXiv:1905.13695>

See Also

RKHSMetaMod

Examples

d <- 3
n <- 50
library(lhs)
X <- maximinLHS(n, d)
c <- c(0.2,0.6,0.8)
F <- 1;for (a in 1:d) F <- F*(abs(4*X[,a]-2)+c[a])/(1+c[a])
epsilon <- rnorm(n,0,1);sigma <- 0.2
Y <- F + sigma*epsilon
Dmax <- 3
kernel <- "matern"
frc <- c(10,100)
gamma <- c(.5,.01,.001,0)
result <- RKHSMetMod(Y,X,kernel,Dmax,gamma,frc,FALSE)

Function to calculate the Gram matrices and their eigenvalues and eigenvectors for a chosen reproducing kernel.

Description

Calculates the Gram matrices KvK_v for v=1,,v=1,\ldots,vMax, and returns their associated eigenvalues and eigenvectors. The calculated Gram matrices may be not positive definite. The option "correction" of this function allows to replace the matrices KvK_v that are not positive definite by their "nearest positive definite" matrices.

Usage

calc_Kv(X, kernel, Dmax, correction, verbose, tol)

Arguments

X

Matrix of observations with nn rows and dd columns.

kernel

Character, the type of the reproducing kernel: matern ((matern kernel)), brownian ((brownian kernel)), gaussian ((gaussian kernel)), linear ((linear kernel)), quad ((quadratic kernel)).

Dmax

Integer, between 11 and dd, indicates the order of interactions considered in the meta model: Dmax=1=1 is used to consider only the main effects, Dmax=2=2 to include the main effects and the interactions of order 2,2,\ldots.

correction

Logical, if TRUE, the program makes the correction to the matrices KvK_v that are not positive definite (see details). Set as TRUE by default.

verbose

Logical, if TRUE, the group vv for which the correction is done is printed. Set as TRUE by default.

tol

Scalar, used if correction is TRUE. For each matrix KvK_v if λmin<λmax×\lambda_{min} < \lambda_{max}\timestol, then the correction to KvK_v is done (see details). Set as 1e81e^{-8} by default.

Details

Let λv,i,i=1,...,n\lambda_{v,i},i=1,...,n be the eigenvalues associated with matrix KvK_v. Set λmax=maxiλv,i\lambda_{max}={max}_{i}\lambda_{v,i} and λmin=miniλv,i\lambda_{min}={min}_{i}\lambda_{v,i}. The eigenvalues of KvK_v that is not positive definite are replaced by λv,i+\lambda_{v,i}+epsilon, with espilon=λmax×=\lambda_{max}\timestol. The value of tol depends on the type of the kernel and it is chosen small.

Value

List of two components "names.Grp" and "kv":

names.Grp

Vector of size vMax, indicates the name of groups included in the meta model.

kv

List of vMax components with the same names as the vector names.Grp. Each element of the list is a list of two components "Evalues" and "Q":

Evalues

Vector of size nn, eigenvalues of each Gram matrix KvK_v.

Q

Matrix with nn rows and nn columns, eigenvectors of each Gram matrix KvK_v.

Note

Note.

Author(s)

Halaleh Kamari

References

Kamari, H., Huet, S. and Taupin, M.-L. (2019) RKHSMetaMod : An R package to estimate the Hoeffding decomposition of an unknown function by solving RKHS Ridge Group Sparse optimization problem. <arXiv:1905.13695>

See Also

RKHSMetaMod

Examples

d <- 3
n <- 50
library(lhs)
X <- maximinLHS(n, d)
c <- c(0.2,0.6,0.8)
F <- 1;for (a in 1:d) F <- F*(abs(4*X[,a]-2)+c[a])/(1+c[a])
epsilon <- rnorm(n,0,1);sigma <- 0.2
Y <- F + sigma*epsilon
Dmax <- 3
kernel <- "matern"
Kv <- calc_Kv(X, kernel, Dmax)
names <- Kv$names.Grp
Eigen.val1 <- Kv$kv$v1.$Evalues
Eigen.vec1 <- Kv$kv$v1.$Q

Function to fit a solution with q active groups of an RKHS Group Lasso problem.

Description

Fits a solution of the group lasso problem based on RKHS, with qq active groups in the obtained solution for the Gaussian regression model. It determines μg(q)\mu_{g}(q), for which the number of active groups in the solution of the RKHS group lasso problem is equal to qq, and returns the RKHS meta model associated with μg(q)\mu_{g}(q).

Usage

grplasso_q(Y, Kv, q, rat, Num)

Arguments

Y

Vector of response observations of size nn.

Kv

List of eigenvalues and eigenvectors of positive definite Gram matrices KvK_v and their associated group names. It should have the same format as the output of the function calc_Kv (see details).

q

Integer, the number of active groups in the obtained solution.

rat

Positive scalar, used to restrict the minimum value of μg\mu_g, to be evaluted in the RKHS Group Lasso algorithm, μmin=μmax/rat\mu_{min}=\mu_{max}/rat. The value μmax\mu_{max} is calculated inside the program, see function mu_max.

Num

Integer, used to restrict the number of different values of the penalty parameter μg\mu_g to be evaluated in the RKHS Group Lasso algorithm, until it achieves μg(q)\mu_g(q): for Num =1= 1 the program is done for 33 values of μg\mu_g, μ1=(μmin+μmax)/2\mu_{1}=(\mu_{min}+\mu_{max})/2, μ2=(μmin+μ1)/2\mu_{2}=(\mu_{min}+\mu_{1})/2 or μ2=(μ1+μmax)/2\mu_{2}=(\mu_{1}+\mu_{max})/2 depending on the value of qq associated with μ1\mu_{1}, μ3=μmin\mu_{3}=\mu_{min}.

Details

Input Kv should contain the eigenvalues and eigenvectors of positive definite Gram matrices KvK_v. It is necessary to set input "correction" in the function calc_Kv equal to "TRUE".

Value

List of 44 components: "mus", "qs", "mu", "res":

mus

Vector, values of the evaluated penalty parameters μg\mu_g in the RKHS group lasso algorithm until it achieves μg(q)\mu_{g}(q).

qs

Vector, number of active groups associated with each value of μg\mu_g in mus.

mu

Scalar, value of μg(q)\mu_{g}(q).

res

An RKHS Group Lasso object:

intercept

Scalar, estimated value of intercept.

teta

Matrix with vMax rows and nn columns. Each row of the matrix is the estimated vector θv\theta_{v} for v=1,...,v=1,...,vMax.

fit.v

Matrix with nn rows and vMax columns. Each row of the matrix is the estimated value of fv=Kvθvf_{v}=K_{v}\theta_{v}.

fitted

Vector of size nn, indicates the estimator of mm.

Norm.H

Vector of size vMax, estimated values of the penalty norm.

supp

Vector of active groups.

Nsupp

Vector of the names of the active groups.

SCR

Scalar, equals to Yf0vKvθv2\Vert Y-f_{0}-\sum_{v}K_{v}\theta_{v}\Vert ^{2}.

crit

Scalar, indicates the value of the penalized criteria.

MaxIter

Integer, number of iterations until convergence is reached.

convergence

TRUE or FALSE. Indicates whether the algorithm has converged or not.

RelDiffCrit

Scalar, value of the first convergence criteria at the last iteration, critlastItercritlastIter1critlastIter1\frac{crit_{lastIter}-crit_{lastIter-1}}{crit_{lastIter-1}}.

RelDiffPar

Scalar, value of the second convergence criteria at the last iteration, θlastIterθlastIter1θlastIter12\Vert\frac{\theta_{lastIter}-\theta_{lastIter-1}}{\theta_{lastIter-1}}\Vert ^{2}.

Note

Note.

Author(s)

Halaleh Kamari

References

Kamari, H., Huet, S. and Taupin, M.-L. (2019) RKHSMetaMod : An R package to estimate the Hoeffding decomposition of an unknown function by solving RKHS Ridge Group Sparse optimization problem. <arXiv:1905.13695>

See Also

calc_Kv, mu_max

Examples

d <- 3
n <- 50
library(lhs)
X <- maximinLHS(n, d)
c <- c(0.2,0.6,0.8)
F <- 1;for (a in 1:d) F <- F*(abs(4*X[,a]-2)+c[a])/(1+c[a])
epsilon <- rnorm(n,0,1);sigma <- 0.2 
Y <- F + sigma*epsilon
Dmax <- 3
kernel <- "matern"
Kv <- calc_Kv(X, kernel, Dmax, TRUE, TRUE)
result <- grplasso_q(Y,Kv,5,100 ,Num=10)
result$mu
result$res$Nsupp

Function to find the maximal value of the penalty parameter in the RKHS Group Lasso problem.

Description

Calculates the value of the penalty parameter in the RKHS group lasso problem when the first penalized parameter group enters the model.

Usage

mu_max(Y, matZ)

Arguments

Y

Vector of response observations of size nn.

matZ

List of vMax components. Each component includes the eigenvalues and eigenvectors of the positive definite Gram matrices Kv,v=1,...,K_v, v=1,...,vMax. It should have the same format as the output "kv" of the function calc_Kv.

Details

Details.

Value

An object of type numeric is returned.

Note

Note.

Author(s)

Halaleh Kamari

References

Kamari, H., Huet, S. and Taupin, M.-L. (2019) RKHSMetaMod : An R package to estimate the Hoeffding decomposition of an unknown function by solving RKHS Ridge Group Sparse optimization problem. <arXiv:1905.13695>

Meier, L. Van de Geer, S. and Buhlmann, P. (2008) The group LASSO for logistic regression. Journal of the Royal Statistical Society Series B. 70. 53-71. 10.1111/j.1467-9868.2007.00627.x.

See Also

calc_Kv

Examples

d <- 3
n <- 50
library(lhs)
X <- maximinLHS(n, d)
c <- c(0.2,0.6,0.8)
F <- 1;for (a in 1:d) F <- F*(abs(4*X[,a]-2)+c[a])/(1+c[a])
epsilon <- rnorm(n,0,1);sigma <- 0.2
Y <- F + sigma*epsilon
Dmax <- 3
kernel <- "matern"
Kv <- calc_Kv(X, kernel, Dmax, TRUE,TRUE)
matZ <- Kv$kv
mumax <- mu_max(Y, matZ)
mumax

Function to fit a solution of the RKHS Ridge Group Sparse problem.

Description

Fits the solution of the RKHS ridge group sparse optimization problem for the Gaussian regression model.

Usage

pen_MetMod(Y, Kv, gamma, mu, resg, gama_v, mu_v, maxIter, verbose, calcStwo)

Arguments

Y

Vector of response observations of size nn.

Kv

List, includes the eigenvalues and eigenvectors of the positive definite Gram matrices Kv,v=1,...,K_v, v=1,...,vMax and their associated group names. It should have the same format as the output of the function calc_Kv (see details).

gamma

Vector of positive scalars. Values of the penalty parameter γ\gamma in decreasing order.

mu

Vector of positive scalars. Values of the penalty parameter μ\mu in decreasing order.

resg

List of initial parameters, includes the RKHSgrplasso objects for each value of the penalty parameter μ\mu.

gama_v

Scalar zero or vector of vMax positive scalars, considered as weights for the Ridge penalty. Set to zero, to consider no weights, i.e. all weights equal to 11.

mu_v

Scalar zero or a vector with vMax scalars, considered as weigths of Sparse Group penalty. Set to zero, to consider no weights, i.e. all weights equal to 11.

maxIter

Integer, shows the maximum number of loops through initial active groups at the first step and maximum number of loops through all groups at the second step. Set as 10001000 by default.

verbose

Logical, if TRUE, for each pair of penalty parameters (μ,γ)(\mu,\gamma) it prints: the number of current iteration, active groups and convergence criterias. Set as FALSE by default.

calcStwo

Logical, if TRUE, the program does a second step after convergence: the algorithm is done over all groups by taking the estimated parameters at the first step as initial values. Set as FALSE by default.

Details

Input Kv should contain the eigenvalues and eigenvectors of positive definite Gram matrices KvK_v. It is necessary to set input "correction" in the function calc_Kv equal to "TRUE".

Value

List of l components, with l equals to the number of pairs of the penalty parameters (μ,γ)(\mu,\gamma). Each component of the list is a list of 33 components "mu", "gamma" and "Meta-Model":

mu

Positive scalar, an element of the input vector mu associated with the estimated Meta-Model.

gamma

Positive scalar, an element of the input vector gamma associated with the estimated Meta-Model.

Meta-Model

Estimated meta model associated with penalty parameters mu and gamma. List of 1616 components:

intercept

Scalar, estimated value of intercept.

teta

Matrix with vMax rows and nn columns. Each row of the matrix is the estimated vector θv\theta_{v} for v=1,...,v=1,...,vMax.

fit.v

Matrix with nn rows and vMax columns. Each row of the matrix is the estimated value of fv=Kvθvf_{v}=K_{v}\theta_{v}.

fitted

Vector of size nn, indicates the estimator of mm.

Norm.n

Vector of size vMax, estimated values for the Ridge penalty norm.

Norm.H

Vector of size vMax, estimated values for the Group Sparse penalty norm.

supp

Vector of active groups.

Nsupp

Vector of the names of the active groups.

SCR

Scalar equals to Yf0vKvθv2\Vert Y-f_{0}-\sum_{v}K_{v}\theta_{v}\Vert ^{2}.

crit

Scalar indicates the value of the penalized criteria.

gamma.v

Vector of size vMax, coefficients of the Ridge penalty norm, nγ×\sqrt{n}\gamma\timesgama_v.

mu.v

Vector of size vMax, coefficients of the Group Sparse penalty norm, nμ×n\mu\timesmu_v.

iter

List of three components if calcStwo==TRUE ((two components if calcStwo==FALSE)): maxIter, number of iterations until convergence is reached at first step and the number of iterations until convergence is reached at second step ((maxIter, and the number of iterations until convergence is reached at first step)).

convergence

TRUE or FALSE. Indicates whether the algorithm has converged or not.

RelDiffCrit

List of two components if calcStwo==TRUE ((one component if calcStwo==FALSE)): value of convergence criteria at the last iteration of each step, θlastIterθlastIter1θlastIter12\Vert\frac{\theta_{lastIter}-\theta_{lastIter-1}}{\theta_{lastIter-1}}\Vert ^{2}.

RelDiffPar

List of two components if calcStwo==TRUE (one component if calcStwo==FALSE): value of convergence criteria at the last iteration, critlastItercritlastIter1critlastIter1\frac{crit_{lastIter}-crit_{lastIter-1}}{crit_{lastIter-1}} of each step.

Note

Note.

Author(s)

Halaleh Kamari

References

Huet, S. and Taupin, M. L. (2017) Metamodel construction for sensitivity analysis. ESAIM: Procs 60, 27-69.

Kamari, H., Huet, S. and Taupin, M.-L. (2019) RKHSMetaMod : An R package to estimate the Hoeffding decomposition of an unknown function by solving RKHS Ridge Group Sparse optimization problem. <arXiv:1905.13695>

See Also

calc_Kv, RKHSgrplasso

Examples

d <- 3
n <- 50
library(lhs)
X <- maximinLHS(n, d)
c <- c(0.2,0.6,0.8)
F <- 1;for (a in 1:d) F <- F*(abs(4*X[,a]-2)+c[a])/(1+c[a])
epsilon <- rnorm(n,0,1);sigma <- 0.2
Y <- F + sigma*epsilon
Dmax <- 3
kernel <- "matern"
Kv <- calc_Kv(X, kernel, Dmax, TRUE,TRUE, tol = 1e-08)
vMax <- length(Kv$names.Grp)
matZ <- Kv$kv
mumax <- mu_max(Y, matZ)
mug1 <- mumax/10
mug2 <- mumax/100
gr1 <- RKHSgrplasso(Y,Kv, mug1)
gr2 <- RKHSgrplasso(Y,Kv, mug2)
gamma <- c(.5,.01,.001)
#rescaling the penalty parameter
mu <- c(mug1/sqrt(n),mug2/sqrt(n))
resg <- list(gr1,gr2)
res <- pen_MetMod(Y,Kv,gamma,mu,resg,0,0)
l <- length(res)
for(i in 1:l){print(res[[i]]$mu)}
for(i in 1:l){print(res[[i]]$gamma)}
for(i in 1:l){print(res[[i]]$`Meta-Model`$Nsupp)}
gama_v <- rep(1,vMax)
mu_v <- rep(1,vMax)
res.w <- pen_MetMod(Y,Kv,gamma,mu,resg,gama_v,mu_v)
for(i in 1:l){print(res.w[[i]]$`Meta-Model`$Nsupp)}

Function to calculate the prediction error.

Description

Computes the prediction error by considering a testing dataset.

Usage

PredErr(X, XT, YT, mu, gamma, res, kernel, Dmax)

Arguments

X

Matrix of observations with nn rows and dd columns.

XT

Matrix of observations of the testing dataset with ntestn^{test} rows and dd columns.

YT

Vector of response observations of testing dataset of size ntestn^{test}.

mu

Vector of positive scalars. Values of the Group Sparse penalty parameter in decreasing order. See function RKHSMetMod.

gamma

Vector of positive scalars. Values of the Ridge penalty parameter in decreasing order. See function RKHSMetMod.

res

List, includes a squence of estimated meta models for the learning dataset, using RKHS Ridge Group Sparse or RKHS Group Lasso algorithm, associated with the penalty parameters mu and gamma. It should have the same format as the output of one of the functions: pen_MetMod, RKHSMetMod or RKHSMetMod_qmax.

kernel

Character, shows the type of the reproducing kernel: matern, brownian, gaussian, linear, quad. The same kernel should be chosen as the one used for the learning dataset. See function calc_Kv.

Dmax

Integer between 11 and dd. The same Dmax should be chosen as the one used for learning dataset. See function calc_Kv.

Details

Details.

Value

Matrix of the prediction errors is returned. Each element of the matrix is the obtained prediction error associated with one RKHS meta model in "res".

Note

Note.

Author(s)

Halaleh Kamari

References

Kamari, H., Huet, S. and Taupin, M.-L. (2019) RKHSMetaMod : An R package to estimate the Hoeffding decomposition of an unknown function by solving RKHS Ridge Group Sparse optimization problem. <arXiv:1905.13695>

See Also

calc_Kv, pen_MetMod, RKHSMetMod, RKHSMetMod_qmax

Examples

d <- 3
n <- 50
nT <- 50
library(lhs)
X <- maximinLHS(n, d)
XT <- maximinLHS(nT, d)
c <- c(0.2,0.6,0.8)
F <- 1;for (a in 1:d) F <- F*(abs(4*X[,a]-2)+c[a])/(1+c[a])
FT <- 1;for (a in 1:d) FT <- FT*(abs(4*XT[,a]-2)+c[a])/(1+c[a])
sigma <- 0.2
epsilon <- rnorm(n,0,1);Y <- F + sigma*epsilon
epsilonT <- rnorm(nT,0,1);YT <- FT + sigma*epsilonT
Dmax <- 3
kernel <- "matern"
frc <- c(10,100)
gamma <- c(.5,.01,.001)
res <- RKHSMetMod(Y,X,kernel,Dmax,gamma,frc,FALSE)
mu <- vector()
l <- length(gamma)
for(i in 1:length(frc)){mu[i]=res[[(i-1)*l+1]]$mu}
error <- PredErr(X,XT, YT,mu,gamma, res, kernel,Dmax)
error

Function to fit a solution of an RKHS Group Lasso problem.

Description

Fits the solution of an RKHS group lasso problem for the Gaussian regression model.

Usage

RKHSgrplasso(Y, Kv, mu, maxIter, verbose)

Arguments

Y

Vector of response observations of size nn.

Kv

List, includes the eigenvalues and eigenvectors of the positive definite Gram matrices Kv,v=1,...,K_v, v=1,...,vMax and their associated group names. It should have the same format as the output of the function calc_Kv (see details).

mu

Positive scalar, value of the penalty parameter μg\mu_g in the RKHS Group Lasso problem.

maxIter

Integer, shows the maximum number of loops through all groups. Set as 10001000 by default.

verbose

Logical, if TRUE, prints: the number of current iteration, active groups and convergence criterias. Set as FALSE by default.

Details

Input Kv should contain the eigenvalues and eigenvectors of positive definite Gram matrices KvK_v. It is necessary to set input correction in the function calc_Kv equal to "TRUE".

Value

Estimated RKHS meta model, list with 1313 components:

intercept

Scalar, estimated value of intercept.

teta

Matrix with vMax rows and nn columns. Each row of the matrix is the estimated vector θv\theta_{v} for v=1,...,v=1,...,vMax.

fit.v

Matrix with nn rows and vMax columns. Each row of the matrix is the estimated value of fv=Kvθvf_{v}=K_{v}\theta_{v}.

fitted

Vector of size nn, indicates the estimator of mm.

Norm.H

Vector of size vMax, estimated values of the penalty norm.

supp

Vector of active groups.

Nsupp

Vector of the names of the active groups.

SCR

Scalar, equals to Yf0vKvθv2\Vert Y-f_{0}-\sum_{v}K_{v}\theta_{v}\Vert ^{2}.

crit

Scalar, indicates the value of penalized criteria.

MaxIter

Integer, number of iterations until convergence is reached.

convergence

TRUE or FALSE. Indicates whether the algorithm has converged or not.

RelDiffCrit

Scalar, value of the first convergence criteria at the last iteration, critlastItercritlastIter1critlastIter1\frac{crit_{lastIter}-crit_{lastIter-1}}{crit_{lastIter-1}}.

RelDiffPar

Scalar, value of the second convergence criteria at the last iteration, θlastIterθlastIter1θlastIter12\Vert\frac{\theta_{lastIter}-\theta_{lastIter-1}}{\theta_{lastIter-1}}\Vert ^{2}.

Note

Note.

Author(s)

Halaleh Kamari

References

Kamari, H., Huet, S. and Taupin, M.-L. (2019) RKHSMetaMod : An R package to estimate the Hoeffding decomposition of an unknown function by solving RKHS Ridge Group Sparse optimization problem. <arXiv:1905.13695>

Meier, L. Van de Geer, S. and Buhlmann, P. (2008) The group LASSO for logistic regression. Journal of the Royal Statistical Society Series B. 70. 53-71. 10.1111/j.1467-9868.2007.00627.x.

See Also

calc_Kv

Examples

d <- 3
n <- 50
library(lhs)
X <- maximinLHS(n, d)
c <- c(0.2,0.6,0.8)
F <- 1;for (a in 1:d) F <- F*(abs(4*X[,a]-2)+c[a])/(1+c[a])
epsilon <- rnorm(n,0,1);sigma <- 0.2
Y <- F + sigma*epsilon
Dmax <- 3
kernel <- "matern"
Kv <- calc_Kv(X, kernel, Dmax, TRUE, TRUE)
matZ <- Kv$kv
mumax <- mu_max(Y, matZ)
mug <- mumax/10
gr <- RKHSgrplasso(Y,Kv, mug , 1000, FALSE)
gr$Nsupp

Function to produce a sequence of meta models that are the solutions of the RKHS Ridge Group Sparse or RKHS Group Lasso optimization problems.

Description

Calculates the Gram matrices KvK_v for a chosen reproducing kernel and fits the solution of an RKHS ridge group sparse or an RKHS group lasso problem for each pair of penalty parameters (μ,γ)(\mu,\gamma), for the Gaussian regression model.

Usage

RKHSMetMod(Y, X, kernel, Dmax, gamma, frc, verbose)

Arguments

Y

Vector of response observations of size nn.

X

Matrix of observations with nn rows and dd columns.

kernel

Character, indicates the type of the reproducing kernel: matern ((matern kernel)), brownian ((brownian kernel)), gaussian ((gaussian kernel)), linear ((linear kernel)), quad ((quadratic kernel)). See the function calc_Kv

Dmax

Integer, between 11 and dd, indicates the order of interactions considered in the meta model: Dmax=1=1 is used to consider only the main effects, Dmax=2=2 to include the main effects and the interactions of order 2,2,\ldots. See the function calc_Kv

gamma

Vector of non negative scalars, values of the penalty parameter γ\gamma in decreasing order. If γ=0\gamma=0 the function solves an RKHS Group Lasso problem and for γ>0\gamma>0 it solves an RKHS Ridge Group Sparse problem.

frc

Vector of positive scalars. Each element of the vector sets a value to the penalty parameter μ\mu, μ=μmax/(n×frc)\mu=\mu_{max}/(\sqrt{n}\times frc). The value μmax\mu_{max} is calculated by the program. See the function mu_max.

verbose

Logical, if TRUE, prints: the group vv for which the correction of Gram matrix KvK_v is done, and for each pair of the penalty parameters (μ,γ)(\mu,\gamma): the number of current iteration, active groups and convergence criterias. Set as FALSE by default.

Details

Details.

Value

List of l components, with l equals to the number of pairs of the penalty parameters (μ,γ)(\mu,\gamma). Each component of the list is a list of 33 components "mu", "gamma" and "Meta-Model":

mu

Positive scalar, penalty parameter μ\mu associated with the estimated Meta-Model.

gamma

Positive scalar, an element of the input vector gamma associated with the estimated Meta-Model.

Meta-Model

An RKHS Ridge Group Sparse or RKHS Group Lasso object associated with the penalty parameters mu and gamma:

intercept

Scalar, estimated value of intercept.

teta

Matrix with vMax rows and nn columns. Each row of the matrix is the estimated vector θv\theta_{v} for v=1,...,v=1,...,vMax.

fit.v

Matrix with nn rows and vMax columns. Each row of the matrix is the estimated value of fv=Kvθvf_{v}=K_{v}\theta_{v}.

fitted

Vector of size nn, indicates the estimator of mm.

Norm.n

Vector of size vMax, estimated values for the Ridge penalty norm.

Norm.H

Vector of size vMax, estimated values of the Sparse Group penalty norm.

supp

Vector of active groups.

Nsupp

Vector of the names of the active groups.

SCR

Scalar, equals to Yf0vKvθv2\Vert Y-f_{0}-\sum_{v}K_{v}\theta_{v}\Vert ^{2}.

crit

Scalar, indicates the value of the penalized criteria.

gamma.v

Vector of size vMax, coefficients of the Ridge penalty norm, nγ×\sqrt{n}\gamma\timesgama_v.

mu.v

Vector of size vMax, coefficients of the Group Sparse penalty norm, nμ×n\mu\timesmu_v.

iter

List of two components: maxIter, and the number of iterations until the convergence is achieved.

convergence

TRUE or FALSE. Indicates whether the algorithm has converged or not.

RelDiffCrit

Scalar, value of the first convergence criteria at the last iteration, θlastIterθlastIter1θlastIter12\Vert\frac{\theta_{lastIter}-\theta_{lastIter-1}}{\theta_{lastIter-1}}\Vert ^{2}.

RelDiffPar

Scalar, value of the second convergence criteria at the last iteration, critlastItercritlastIter1critlastIter1\frac{crit_{lastIter}-crit_{lastIter-1}}{crit_{lastIter-1}}.

Note

For the case γ=0\gamma=0 the outputs "mu"=μg=\mu_g and "Meta-Model" is the same as the one returned by the function RKHSgrplasso.

Author(s)

Halaleh Kamari

References

Kamari, H., Huet, S. and Taupin, M.-L. (2019) RKHSMetaMod : An R package to estimate the Hoeffding decomposition of an unknown function by solving RKHS Ridge Group Sparse optimization problem. <arXiv:1905.13695>

See Also

calc_Kv, mu_max, RKHSgrplasso, pen_MetMod

Examples

d <- 3
n <- 50
library(lhs)
X <- maximinLHS(n, d)
c <- c(0.2,0.6,0.8)
F <- 1;for (a in 1:d) F <- F*(abs(4*X[,a]-2)+c[a])/(1+c[a])
epsilon <- rnorm(n,0,1);sigma <- 0.2
Y <- F + sigma*epsilon
Dmax <- 3
kernel <- "matern"
frc <- c(10,100)
gamma <- c(.5,.01,.001,0)
result <- RKHSMetMod(Y,X,kernel,Dmax,gamma,frc,FALSE)
l <- length(result)
for(i in 1:l){print(result[[i]]$mu)}
for(i in 1:l){print(result[[i]]$gamma)}
for(i in 1:l){print(result[[i]]$`Meta-Model`$Nsupp)}

Function to produce a sequence of meta models, with at most qmax active groups in each meta model. The meta models are the solutions of the RKHS Ridge Group Sparse or RKHS Group Lasso optimization problems.

Description

Calculates the Gram matrices KvK_v for a chosen kernel, determines μ\mu, note μ(qmax)\mu (qmax), for which the number of active groups in the RKHS group lasso solution is equal to qmax, and fits a solution of an RKHS ridge group sparse or an RKHS group lasso problem for each pair of penalty parameters (μ(qmax),γ)(\mu (qmax),\gamma), in the Gaussian regression model.

Usage

RKHSMetMod_qmax(Y, X, kernel, Dmax, gamma, qmax, rat, Num, verbose)

Arguments

Y

Vector of response observations of size nn.

X

Matrix of observations with nn rows and dd columns.

kernel

Character, indicates the type of the reproducing kernel: matern ((matern kernel)), brownian ((brownian kernel)), gaussian ((gaussian kernel)), linear ((linear kernel)), quad ((quadratic kernel)). See the function calc_Kv.

Dmax

Integer, between 11 and dd, indicates the order of interactions considered in the meta model: Dmax=1=1 is used to consider only the main effects, Dmax=2=2 to include the main effects and the interactions of order 2,2,\ldots. See the function calc_Kv.

gamma

Vector of non negative scalars, values of the penalty parameter γ\gamma in decreasing order. If γ=0\gamma=0 the function solves an RKHS Group Lasso problem and for γ>0\gamma>0 it solves an RKHS Ridge Group Sparse problem.

qmax

Integer, shows the maximum number of active groups in the obtained solution.

rat

Positive scalar, to restrict the minimum value of μ\mu considered in the algorithm, μmin=μmax/(n×rat)\mu_{min}=\mu_{max}/(\sqrt{n}\times rat). The value μmax\mu_{max} is calculated inside the program, see function mu_max.

Num

Integer, it is used to restrict the number of different values of the penalty parameter μ\mu to be evaluated in the RKHS Group Lasso algorithm until it achieves μ(qmax)\mu (qmax): for Num =1= 1 the program is done for 33 different values of μ\mu, μ1=(μmin+μmax)/2\mu_{1}=(\mu_{min}+\mu_{max})/2, μ2=(μmin+μ1)/2\mu_{2}=(\mu_{min}+\mu_{1})/2 or μ2=(μ1+μmax)/2\mu_{2}=(\mu_{1}+\mu_{max})/2 depending on the number of active groups in the meta model associated with μ1\mu_{1}, μ3=μmin\mu_{3}=\mu_{min}.

verbose

Logical, if TRUE, prints: the group vv for which the correction of Gram matrix KvK_v is done, and for each pair of (μ,γ)(\mu,\gamma): the number of current iteration, active groups and convergence criterias. Set as FALSE by default.

Details

Details.

Value

List of three components "mus", "qs", and "MetaModel":

mus

Vector, values of the evaluated penalty parameters μ\mu in the RKHS Group Lasso algorithm until it achieves μ(qmax)\mu (qmax).

qs

Vector, number of active groups associated with each element in mus.

MetaModel

List with the same length as the vector gamma. Each component of the list is a list of 33 components "mu", "gamma" and "Meta-Model":

mu

Scalar, the value μ(qmax)\mu (qmax).

gamma

Positive scalar, element of the input vector gamma associated with the estimated Meta-Model.

Meta-Model

An RKHS Ridge Group Sparse or RKHS Group Lasso object associated with the penalty parameters mu and gamma:

intercept

Scalar, estimated value of intercept.

teta

Matrix with vMax rows and nn columns. Each row of the matrix is the estimated vector θv\theta_{v} for v=1,...,v=1,...,vMax.

fit.v

Matrix with nn rows and vMax columns. Each row of the matrix is the estimated value of fv=Kvθvf_{v}=K_{v}\theta_{v}.

fitted

Vector of size nn, indicates the estimator of mm.

Norm.n

Vector of size vMax, estimated values for the Ridge penalty norm.

Norm.H

Vector of size vMax, estimated values of the Sparse Group penalty norm.

supp

Vector of active groups.

Nsupp

Vector of the names of the active groups.

SCR

Scalar, equals to Yf0vKvθv2\Vert Y-f_{0}-\sum_{v}K_{v}\theta_{v}\Vert ^{2}.

crit

Scalar, indicates the value of penalized criteria.

gamma.v

Vector, coefficients of the Ridge penalty norm, nγ×\sqrt{n}\gamma\timesgama_v.

mu.v

Vector, coefficients of the Group Sparse penalty norm, nμ×n\mu\timesmu_v.

iter

List of two components: maxIter, and the number of iterations until the convergence is achieved.

convergence

TRUE or FALSE. Indicates whether the algorithm has converged or not.

RelDiffCrit

Scalar, value of the first convergence criteria at the last iteration, θlastIterθlastIter1θlastIter12\Vert\frac{\theta_{lastIter}-\theta_{lastIter-1}}{\theta_{lastIter-1}}\Vert ^{2}.

RelDiffPar

Scalar, value of the second convergence criteria at the last iteration, critlastItercritlastIter1critlastIter1\frac{crit_{lastIter}-crit_{lastIter-1}}{crit_{lastIter-1}}.

Note

For the case γ=0\gamma=0 the outputs "mu"=μg=\mu_{g} and "Meta-Model" is the same as the one returned by the function RKHSgrplasso.

Author(s)

Halaleh Kamari

References

Kamari, H., Huet, S. and Taupin, M.-L. (2019) RKHSMetaMod : An R package to estimate the Hoeffding decomposition of an unknown function by solving RKHS Ridge Group Sparse optimization problem. <arXiv:1905.13695>

See Also

calc_Kv, mu_max, RKHSgrplasso, pen_MetMod, grplasso_q

Examples

d <- 3
n <- 50
library(lhs)
X <- maximinLHS(n, d)
c <- c(0.2,0.6,0.8)
F <- 1;for (a in 1:d) F <- F*(abs(4*X[,a]-2)+c[a])/(1+c[a])
epsilon <- rnorm(n,0,1);sigma <- 0.2
Y <- F + sigma*epsilon
Dmax <- 3
kernel <- "matern"
gamma <- c(.5,.01,.001,0)
Num <- 10
rat <- 100
qmax <- 4
result <- RKHSMetMod_qmax(Y, X, kernel, Dmax, gamma, qmax, rat, Num,FALSE)
names(result)
result$mus
result$qs
l <- length(gamma)
for(i in 1:l){print(result$MetaModel[[i]]$mu)}
for(i in 1:l){print(result$MetaModel[[i]]$gamma)}
for(i in 1:l){print(result$MetaModel[[i]]$`Meta-Model`$Nsupp)}

Function to calculate the empirical sensitivity indices for an input or a group of inputs.

Description

Calculates the empirical sensitivity indices.

Usage

SI_emp(res,ErrPred)

Arguments

res

List, includes a sequence of estimated meta models, the solutions of the RKHS Ridge Group Sparse or RKHS Group Lasso problems. It should has the same format as the output of one of the functions: pen_MetMod, RKHSMetMod or RKHSMetMod_qmax.

ErrPred

Matrix or NULL. If matrix, each element of the matrix is the obtained prediction error associated with one RKHS meta model in "res". It should have the same format as the output of the function PredErr. Set as "NULL" by default.

Details

Details.

Value

If input ErrPred\neq"NULL", Vector of the empirical sensitivity incdices for the meta model with the minimum Prediction error is returned. If ErrPred=="NULL", a list of the vectors is returned. Each vector is the obtained sensitivity indices associated with one meta model in "res".

Note

Note.

Author(s)

Halaleh Kamari

References

Kamari, H., Huet, S. and Taupin, M.-L. (2019) RKHSMetaMod : An R package to estimate the Hoeffding decomposition of an unknown function by solving RKHS Ridge Group Sparse optimization problem. <arXiv:1905.13695>

See Also

PredErr, pen_MetMod, RKHSMetMod, RKHSMetMod_qmax

Examples

d <- 3
n <- 50;nT <- 50
library(lhs)
X <- maximinLHS(n, d);XT <- maximinLHS(nT, d)
c <- c(0.2,0.6,0.8)
F <- 1;for (a in 1:d) F <- F*(abs(4*X[,a]-2)+c[a])/(1+c[a])
FT <- 1;for (a in 1:d) FT <- FT*(abs(4*XT[,a]-2)+c[a])/(1+c[a])
sigma <- 0.2
epsilon <- rnorm(n,0,1);Y <- F + sigma*epsilon
epsilonT <- rnorm(nT,0,1);YT <- FT + sigma*epsilonT
Dmax <- 3
kernel <- "matern"
frc <- c(10)
gamma=c(.5,.01,.001)
res <- RKHSMetMod(Y,X,kernel,Dmax,gamma,frc,FALSE)
mu <- vector()
l <- length(gamma)
for(i in 1:length(frc)){mu[i]=res[[(i-1)*l+1]]$mu}
error <- PredErr(X,XT, YT,mu,gamma, res, kernel,Dmax)
SI.minErr  <- SI_emp(res, error)
SI.minErr
SI <- SI_emp(res, NULL)
SI