get_var_props_over_chain: Get the Variable Inclusion Proportions

View source: R/bart_package_inits.R

get_var_props_over_chainR Documentation

Get the Variable Inclusion Proportions

Description

Computes the variable inclusion proportions for a BART model.

Usage

get_var_props_over_chain(bart_machine, type = "splits")

Arguments

bart_machine

An object of class “bartMachine”.

type

If “splits”, then the proportion of times each variable is chosen for a splitting rule versus all splitting rules is computed. If “trees”, then the proportion of times each variable appears in a tree versus all appearances of variables in trees is computed.

Value

Returns a vector of the variable inclusion proportions.

Author(s)

Adam Kapelner and Justin Bleich

See Also

get_var_counts_over_chain

Examples

## Not run: 
#generate Friedman data
set.seed(11)
n  = 200 
p = 10
X = data.frame(matrix(runif(n * p), ncol = p))
y = 10 * sin(pi* X[ ,1] * X[,2]) +20 * (X[,3] -.5)^2 + 10 * X[ ,4] + 5 * X[,5] + rnorm(n)

##build BART regression model
bart_machine = bartMachine(X, y, num_trees = 20)

#Get variable inclusion proportions
var_props = get_var_props_over_chain(bart_machine)
print(var_props)

## End(Not run)

bartMachine documentation built on July 9, 2023, 5:59 p.m.