Skip to contents

Saturation is an EFFICIENCY warning, not a validity one: unlike a divergence it does not bias the draws.

Usage

Treedepth(depths, max_depth = 10)

Arguments

depths

Tree depth reached at each iteration.

max_depth

The configured maximum tree depth.

Value

List with saturated, n_saturated, mean_depth, max_observed, mean_leapfrog, total_leapfrog, warn, n.

Details

Formula: saturated = #{ i : depth_i >= max_depth } / n; leapfrog steps per iteration ~ 2^depth_i

References

Hoffman & Gelman (2014), Journal of Machine Learning Research 15, 1593-1623; Betancourt (2017), arXiv:1701.02434. Bayesian Data Analysis, 3rd edition, describes HMC but not the tree-depth diagnostic.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Treedepth(V)
#> $saturated
#> [1] 0
#> 
#> $n_saturated
#> [1] 0
#> 
#> $mean_depth
#> [1] 4.5
#> 
#> $max_observed
#> [1] 8
#> 
#> $mean_leapfrog
#> [1] 63.75
#> 
#> $total_leapfrog
#> [1] 510
#> 
#> $warn
#> [1] 0
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "NUTS tree-depth saturation diagnostic"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"