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

fix: No longer append .0 to selected names in short tree forests.

fixes #13
parent d3464058
No related branches found
No related tags found
No related merge requests found
Type: Package Type: Package
Package: RFSurrogates Package: RFSurrogates
Title: Surrogate Minimal Depth Variable Importance Title: Surrogate Minimal Depth Variable Importance
Version: 0.4.0 Version: 0.4.1
Authors@R: c( Authors@R: c(
person("Stephan", "Seifert", , "stephan.seifert@uni-hamburg.de", role = c("aut", "cre"), person("Stephan", "Seifert", , "stephan.seifert@uni-hamburg.de", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-2567-5728")), comment = c(ORCID = "0000-0003-2567-5728")),
...@@ -36,4 +36,4 @@ LinkingTo: ...@@ -36,4 +36,4 @@ LinkingTo:
Config/testthat/edition: 3 Config/testthat/edition: 3
Encoding: UTF-8 Encoding: UTF-8
LazyData: true LazyData: true
RoxygenNote: 7.2.3 RoxygenNote: 7.3.2
# RFSurrogates 0.4.1
- Fix `SurrogateMinimalDepth`'s result `$selected` returning modified names (#13)
# RFSurrogates 0.4.0 # RFSurrogates 0.4.0
**Added `RandomForestSurrogates()`.** **Added `RandomForestSurrogates()`.**
......
...@@ -86,6 +86,7 @@ surrmindep <- function(forest, s.l = count.surrogates(forest$trees)$s.l) { ...@@ -86,6 +86,7 @@ surrmindep <- function(forest, s.l = count.surrogates(forest$trees)$s.l) {
p.1 <- 1 - p.root p.1 <- 1 - p.root
threshold <- p.root * 0 + p.1 * 1 threshold <- p.root * 0 + p.1 * 1
warning("Trees are very small! Threshold is defined based on trees with only root nodes.") warning("Trees are very small! Threshold is defined based on trees with only root nodes.")
threshold <- unname(threshold)
} }
if ((avgTreeHeight) >= 2) { if ((avgTreeHeight) >= 2) {
......
...@@ -7,23 +7,21 @@ ...@@ -7,23 +7,21 @@
surrmindep(forest, s.l = count.surrogates(forest$trees)$s.l) surrmindep(forest, s.l = count.surrogates(forest$trees)$s.l)
} }
\arguments{ \arguments{
\item{forest}{a list containing \code{allvariables} and \code{trees}. \item{forest}{a list containing `allvariables` and `trees`.
Allvariables is a vector of all variable names in the original data set (strings). Allvariables is a vector of all variable names in the original data set (strings).
Trees is a list of trees that was generated by \code{\link[=getTreeranger]{getTreeranger()}}, Trees is a list of trees that was generated by [getTreeranger()],
\code{\link[=addLayer]{addLayer()}}, and \code{\link[=addSurrogates]{addSurrogates()}}.} [addLayer()], and [addSurrogates()].}
\item{s.l}{Number of average surrogate variables in the respective layers. \item{s.l}{Number of average surrogate variables in the respective layers.
(use \code{\link[=count.surrogates]{count.surrogates()}} function to get it)} (use [count.surrogates()] function to get it)}
} }
\value{ \value{
List with the following components: List with the following components:
\itemize{ * `depth`: mean surrogate minimal depth for each variable
\item \code{depth}: mean surrogate minimal depth for each variable * `selected`: variables has been selected (1) or not (0),
\item \code{selected}: variables has been selected (1) or not (0), * `threshold`: the threshold that is used for the selection
\item \code{threshold}: the threshold that is used for the selection
}
} }
\description{ \description{
This function determines the surrogate minimal depth of variables from a This function determines the surrogate minimal depth of variables from a
forest that is created by \code{\link[=getTreeranger]{getTreeranger()}}, \code{\link[=addLayer]{addLayer()}} and \code{\link[=addSurrogates]{addSurrogates()}} functions. forest that is created by [getTreeranger()], [addLayer()] and [addSurrogates()] functions.
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment