Learn R Programming

SDModels (version 2.0.2)

regPath.SDForest: Calculate the regularization path of an SDForest

Description

This function calculates the variable importance of an SDForest and the out-of-bag performance for different complexity parameters.

Usage

# S3 method for SDForest
regPath(
  object,
  cp_seq = NULL,
  X = NULL,
  Y = NULL,
  Q = NULL,
  verbose = TRUE,
  mc.cores = 1,
  ...
)

Value

An object of class paths containing

cp

The sequence of complexity parameters.

varImp_path

A matrix with the variable importance for each complexity parameter.

loss_path

A matrix with the out-of-bag performance for each complexity parameter.

cp_min

The complexity parameter with the lowest out-of-bag performance.

type

Path type

Arguments

object

an SDForest object

cp_seq

A sequence of complexity parameters. If NULL, the sequence is calculated automatically using only relevant values.

X

The training data, if NULL the data from the forest object is used.

Y

The training response variable, if NULL the data from the forest object is used.

Q

The transformation matrix, if NULL the data from the forest object is used.

verbose

If TRUE progress updates are shown using the `progressr` package. To customize the progress bar, see [`progressr` package](https://progressr.futureverse.org/articles/progressr-intro.html)

mc.cores

Number of cores to use for parallel computation `vignette("Runtime")`. The `future` package is used for parallel processing. To use custom processing plans mc.cores has to be <= 1, see [`future` package](https://future.futureverse.org/).

...

Further arguments passed to or from other methods.

Author

Markus Ulmer

See Also

plot.paths plotOOB regPath.SDTree prune get_cp_seq SDForest

Examples

Run this code
set.seed(1)
n <- 10
X <- matrix(rnorm(n * 5), nrow = n)
y <- sign(X[, 1]) * 3 + sign(X[, 2]) + rnorm(n)
model <- SDForest(x = X, y = y, Q_type = 'no_deconfounding', cp = 0.5)
paths <- regPath(model)
plotOOB(paths)
plot(paths)
# \donttest{
plot(paths, plotly = TRUE)
# }

Run the code above in your browser using DataLab