VarImp Objects
VarImp.Rd
A class for random forest variable importance measures VarImp
objects.
Usage
as.VarImp(object, ...)
## S3 method for class 'data.frame'
# S3 method for class 'data.frame'
as.VarImp(object, FUN = mean,
type = c("Permutation", "Conditional Permutation",
"Selection Frequency", "See Info"),
info = NULL, ...)
## S3 method for class 'matrix'
# S3 method for class 'matrix'
as.VarImp(object, FUN = mean,
type = c("Permutation", "Conditional Permutation",
"Selection Frequency", "See Info"),
info = NULL, ...)
## S3 method for class 'numeric'
# S3 method for class 'numeric'
as.VarImp(object, perTree = NULL,
type = c("Permutation", "Conditional Permutation",
"Selection Frequency", "See Info"),
info = NULL, ...)
is.VarImp(VarImp)
Arguments
- object
an R object.
- perTree
a matrix or data frame of size
ntree x p
containing the variable importance measures for each tree in the random forest.- type
a character indicating the type of variable importance measure.
- info
a list with additional information about the variable importance measure.
- FUN
a function to compute the variable importance. See section 'Details'.
- VarImp
an object of the class
VarImp
.- ...
additional arguments.
Details
as.VarImp
creates an object of class 'VarImp'. When object
is a
matrix
or a data.frame
, the final values
are computed by applying FUN
to its columns. is.VarImp
returns a logical indicating whether the evaluated object is of class
'VarImp'.
Examples
## Matrix of fake importance measures per Tree
set.seed(290875)
ntree <- 500
p <- 15
fakeVIM <- matrix(rnorm(ntree * p), nrow = ntree, ncol = p,
dimnames = list(paste0("pred", seq_len(ntree)), paste0("pred", seq_len(p))))
is.VarImp(fakeVIM)
#> [1] FALSE
## make a 'VarImp' object
fakeVarImp <- as.VarImp(fakeVIM, type = "See Info",
info = list("The Vims are based on fake data.",
"The mean was used to aggregate across the trees"))
is.VarImp(fakeVarImp)
#> [1] TRUE