Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

tune_ll_regression_forest

Local linear forest tuning


Description

Finds the optimal ridge penalty for local linear prediction.

Usage

tune_ll_regression_forest(
  forest,
  linear.correction.variables = NULL,
  ll.weight.penalty = FALSE,
  num.threads = NULL,
  lambda.path = NULL
)

Arguments

forest

The forest used for prediction.

linear.correction.variables

Variables to use for local linear prediction. If left null, all variables are used. Default is NULL.

ll.weight.penalty

Option to standardize ridge penalty by covariance (TRUE), or penalize all covariates equally (FALSE). Defaults to FALSE.

num.threads

Number of threads used in training. If set to NULL, the software automatically selects an appropriate amount.

lambda.path

Optional list of lambdas to use for cross-validation.

Value

A list of lambdas tried, corresponding errors, and optimal ridge penalty lambda.

Examples

# Find the optimal tuning parameters.
n <- 500
p <- 10
X <- matrix(rnorm(n * p), n, p)
Y <- X[, 1] * rnorm(n)
forest <- regression_forest(X, Y)
tuned.lambda <- tune_ll_regression_forest(forest)

# Use this parameter to predict from a local linear forest.
predictions <- predict(forest, linear.correction.variables = 1:p,
                       ll.lambda = tuned.lambda$lambda.min)

grf

Generalized Random Forests

v1.2.0
GPL-3
Authors
Julie Tibshirani [aut, cre], Susan Athey [aut], Rina Friedberg [ctb], Vitor Hadad [ctb], David Hirshberg [ctb], Luke Miner [ctb], Erik Sverdrup [ctb], Stefan Wager [aut], Marvin Wright [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.