Skip to content
Snippets Groups Projects
Verified Commit f806589e authored by Gärber, Florian's avatar Gärber, Florian
Browse files

feat: Add default to s.l in surrmindep

parent 8b7d5d3d
Branches
No related tags found
No related merge requests found
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
#' \item threshold: the threshold that is used for the selection #' \item threshold: the threshold that is used for the selection
#' } #' }
#' @export #' @export
surrmindep <- function(forest, s.l) { surrmindep <- function(forest, s.l = count.surrogates(forest$trees)$s.l) {
variables <- forest[["allvariables"]] variables <- forest$allvariables
trees <- forest[["trees"]] trees <- forest$trees
num.trees <- length(trees) num.trees <- length(trees)
var.num <- length(variables) var.num <- length(variables)
...@@ -107,16 +107,10 @@ surrmindep <- function(forest, s.l) { ...@@ -107,16 +107,10 @@ surrmindep <- function(forest, s.l) {
threshold <- sum(layers * probs.used) threshold <- sum(layers * probs.used)
} }
# Decide if variables are important or unimportant results <- list(
Importances <- rep(NA, var.num) depth = mean.depth,
for (p in 1:var.num) { selected = sapply(mean.depth, function(x) x < threshold),
if (mean.depth[p] < threshold) { threshold = threshold
Importances[p] <- 1 )
} else {
Importances[p] <- 0
}
}
names(Importances) <- variables
results <- list(depth = mean.depth, selected = Importances, threshold = threshold)
return(results) return(results)
} }
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
\alias{surrmindep} \alias{surrmindep}
\title{Execute surrogate minimal depth variable importance} \title{Execute surrogate minimal depth variable importance}
\usage{ \usage{
surrmindep(forest, s.l) surrmindep(forest, s.l = count.surrogates(forest$trees)$s.l)
} }
\arguments{ \arguments{
\item{forest}{a list containing allvariables and trees. Allvariables is a vector of all variable names in the original data set (strings). Trees is a list of trees that was generated by getTreeranger, addLayer, and getSurrogates functions.} \item{forest}{a list containing allvariables and trees. Allvariables is a vector of all variable names in the original data set (strings). Trees is a list of trees that was generated by getTreeranger, addLayer, and getSurrogates functions.}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment