var_importance.uforest | R Documentation |
This is the extractor function for variable importance measures as produced by
utree
and uforest
.
## S3 method for class 'uforest' var_importance(x, type = "I", valid.data = NULL, error.fun = "sel") ## S3 method for class 'utree' var_importance(x, type = "I", valid.data = NULL, error.fun = "sel")
x |
An object of class |
type |
Either |
valid.data |
For |
error.fun |
The prediction error used to compute variable importance when
|
For type I, the measure of importance given to a predictor is the sum of the values given by the split-criterion produced over all internal nodes for which it was chosen as the splitting variable. For uplift random forest, this relative influence measure is naturally extended by averaging the importance for each variable over the collection of trees. For type II, variable importance is measured based on an independent validation sample, with the aim of quantifying the prediction strength of each variable. This is achieved by first measuring the prediction accuracy on this validation sample. Subsequently, the values for the jth variable are randomly permuted, and the accuracy again computed. The decrease in accuracy as a result of this permutation is the importance attributed to the jth variable.The accuracy is measured by the squared-error or absolute error between the predicted and true uplift on each terminal node of the tree.
A data frame with the variable importance.
Leo Guelman leo.guelman@gmail.com
set.seed(1) df <- sim_uplift(n = 1000, p = 50, response = "binary") form <- create_uplift_formula(x = names(df)[-c(1:3)], y = "y", trt = "T") fit <- utree(form, data = df, maxdepth = 3) var_importance(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.