MVS {mvs} | R Documentation |
Multi-View Stacking
Description
Fit a multi-view stacking model with two or more levels.
Usage
MVS(
x,
y,
views,
type = "StaPLR",
levels = 2,
alphas = c(0, 1),
nnc = c(0, 1),
parallel = FALSE,
seeds = NULL,
progress = TRUE,
...
)
mvs(
x,
y,
views,
type = "StaPLR",
levels = 2,
alphas = c(0, 1),
nnc = c(0, 1),
parallel = FALSE,
seeds = NULL,
progress = TRUE,
...
)
Arguments
x |
input matrix of dimension nobs x nvars. |
y |
outcome vector of length nobs. |
views |
a matrix of dimension nvars x (levels - 1), where each entry is an integer describing to which view each feature corresponds. |
type |
the type of MVS model to be fitted. Currently only type "StaPLR" is supported. |
levels |
an integer >= 2, specifying the number of levels in the MVS procedure. |
alphas |
a vector specifying the value of the alpha parameter to use at each level. |
nnc |
a binary vector specifying whether to apply nonnegativity constraints or not (1/0) at each level. |
parallel |
whether to use foreach to fit the learners and obtain the cross-validated predictions at each level in parallel. Executes sequentially unless a parallel back-end is registered beforehand. |
seeds |
(optional) a vector specifying the seed to use at each level. |
progress |
whether to show a progress bar (only supported when parallel = FALSE). |
... |
additional arguments to pass to the learning algorithm. See e.g. ?StaPLR. Note that these arguments are passed to the the learner at every level of the MVS procedure. |
Value
An object of S3 class "MVS".
Author(s)
Wouter van Loon <w.s.van.loon@fsw.leidenuniv.nl>
Examples
set.seed(012)
n <- 1000
X <- matrix(rnorm(8500), nrow=n, ncol=85)
top_level <- c(rep(1,45), rep(2,20), rep(3,20))
bottom_level <- c(rep(1:3, each=15), rep(4:5, each=10), rep(6:9, each=5))
views <- cbind(bottom_level, top_level)
beta <- c(rep(10, 55), rep(0, 30)) * ((rbinom(85, 1, 0.5)*2)-1)
eta <- X %*% beta
p <- 1 /(1 + exp(-eta))
y <- rbinom(n, 1, p)
fit <- MVS(x=X, y=y, views=views, type="StaPLR", levels=3, alphas=c(0,1,1), nnc=c(0,1,1))
coefficients <- coef(fit)
new_X <- matrix(rnorm(2*85), nrow=2)
predict(fit, new_X)