Configuring NUTS involves putting a cap on the depth of the
trees that it evaluates during each iteration. This is controlled through
a maximum depth parameter. n_leapfrog
is then bounded
by 2 to the power of the maximum depth minus 1.
Tree depth is an important diagnostic tool for
NUTS. For example, a treedepth = 0
occurs when the first leapfrog
step is immediately rejected and the initial state returned, indicating extreme
curvature and poorly-chosen stepsize
(at least relative to the
current position).
On the other hand, treedepth = max_treedepth
equal to the maximum depth
indicates that NUTS is taking many leapfrog steps and being terminated
prematurely to avoid excessively long execution time.
Taking very many steps may be a sign of poor adaptation, may be due to targeting a very high acceptance rate, or may simply indicate a difficult posterior from which to sample. In the latter case, reparameterization may help with efficiency. But in the rare cases where the model is correctly specified and a large number of steps is necessary, the maximum depth should be increased to ensure that that the NUTS tree can grow as large as necessary.