treeDepth {bartMan}R Documentation

treeDepth

Description

A plot of tree depth over iterations.

Usage

treeDepth(trees)

Arguments

trees

A list of tree attributes created using the extractTreeData function.

Value

A plot of average tree depths over iteration

Examples

if(requireNamespace("dbarts", quietly = TRUE)){
 # Load the dbarts package to access the bart function
 library(dbarts)
 # Get Data
 df <- na.omit(airquality)
 # Create Simple dbarts Model For Regression:
 set.seed(1701)
 dbartModel <- bart(df[2:6], df[, 1], ntree = 5, keeptrees = TRUE, nskip = 10, ndpost = 10)

 # Tree Data
 trees_data <- extractTreeData(model = dbartModel, data = df)
 treeDepth(trees = trees_data)
}


[Package bartMan version 0.1.0 Index]