# \donttest{
library(ggplot2)
library(boot)
# Test case : the non-monotonic Sobol g-function
# Only one kernel is provided with default hyperparameter value
n <- 50
X <- data.frame(matrix(runif(8 * n), nrow = n))
# HSIC-based GSA and asymptotic independence test
x <- sensiHSIC(model = sobol.fun, X, kernelX = "rbf", kernelY = "rbf",
test.method = "Asymptotic")
print(x)
# HSIC-based GSA and permutation independence test
x <- sensiHSIC(model = sobol.fun, X, kernelX = "rbf", kernelY = "rbf",
estimator.type = "U-stat", test.method = "Permutation")
print(x)
# HSIC-based GSA and independence test with optimized number of permutations
x <- sensiHSIC(model = sobol.fun, X, kernelX = "rbf", kernelY = "rbf",
test.method = "Seq_Permutation",
crit.option = list(stop.criterion = "ranking", alpha = 0.05,
Bstart = 100, Bfinal = 3000, Bbatch = 100, lo = 100,
graph = TRUE))
print(x)
# Target-HSIC GSA in case of given model
x <- sensiHSIC(model = sobol.fun, X, target = list(c = 0.4, upper = TRUE,
type = "indicTh", param = 1), kernelX = "rbf",
kernelY = "categ", test.method = "Permutation")
# Target-HSIC GSA in case of given data
x <- sensiHSIC(model = NULL, X, target = list(c = 0.4, upper = TRUE,
type = "indicTh", param = 1), kernelX = "rbf",
kernelY = "categ", test.method = "Permutation")
y <- sobol.fun(X)
tell(x,y)
# Conditional-HSIC GSA in case of given model
x <- sensiHSIC(model = sobol.fun, X, cond = list(c = 0.4, upper = TRUE,
type = "indicTh", param = 1), kernelX = "rbf", kernelY = "rbf",
test.method = "Permutation",B=3000)
# Conditional-HSIC GSA in case of given data
x <- sensiHSIC(model = NULL, X, cond = list(c = 0.4, upper = TRUE,
type = "indicTh", param = 1), kernelX = "rbf", kernelY = "rbf",
test.method = "Seq_Permutation", crit.option =
list(stop.criterion = "ranking", alpha = 0.05, Bstart = 100,
Bfinal = 3000, Bbatch = 100, lo = 100, graph = TRUE))
y <- sobol.fun(X)
tell(x,y)
# Test case : the Ishigami function
# A list of kernels is given with default hyperparameter value
n <- 100
X <- data.frame(matrix(-pi+2*pi*runif(3 * n), nrow = n))
x <- sensiHSIC(model = ishigami.fun, X, kernelX = c("rbf","matern3","dcov"),
kernelY = "rbf")
print(x)
ggplot(x)
# A combination of kernels is given and a dummy value is passed for
# the first hyperparameter
x <- sensiHSIC(model = ishigami.fun, X, kernelX = c("ssanova1","matern3","dcov"),
paramX = c(1,2,1), kernelY = "ssanova1")
print(x)
ggplot(x)
# Example in case of given data
n <- 100
X <- data.frame(matrix(-pi+2*pi*runif(3 * n), nrow = n))
Y <- ishigami.fun(X)
x <- sensiHSIC(model = NULL, X)
tell(x,Y)
print(x)
ggplot(x)
# Test case: functional toy fct 'Arctangent temporal function' with PCA pre-processing
# step and a dummy variable
# Put in comment because too long for the CRAN tests
#n <- 500
#X <- data.frame(matrix(runif(3*n,-7,7), nrow = n)) # We add a dummy variable
#Y <- atantemp.fun(X)
#x <- sensiHSIC(model = NULL, X, kernelX = "dcov", kernelY = "dcov", expl.var.PCA = 0.95,
# test.method = "Permutation")
#tell(x,Y)
#print(x)
#ggplot(x)
# Test case: Multiclass classification
n <- 200 # put n=500 for more consistency
X <- data.frame(matrix(-pi+2*pi*runif(3 * n), nrow = n))
Ytemp <- ishigami.fun(X)
# Create output variable
Y <- rep(NA,n)
Y[Ytemp<0] <- 0
Y[Ytemp>=0 & Ytemp<10] <- 1
Y[Ytemp>=10] <- 2
x <- sensiHSIC(model = NULL, X, kernelX = "dcov", kernelY = "categ", paramY = "weighted",
test.method = "Permutation")
tell(x,Y)
print(x)
ggplot(x)
# }
Run the code above in your browser using DataLab