3
$\begingroup$

I recently ran a model with this output:

[1] "110 of 4000 iterations saturated the maximum tree depth of 10 (2.75%)"
[1] "Run again with max_depth set to a larger value to avoid saturation"

I don't have a sense of whether this is high or low. What is a good number of tree depth saturations?

$\endgroup$

2 Answers 2

8
$\begingroup$

In No-U-Turn-Sampler a maximum tree depth of 10 is a sensible default, but occasionally you have to increase it. In my experience not usually by much. I might try 12 next and I have never had to go beyond 15, so far. As it increases computation time, it is not a good trade-off to make it higher by default - unless you always run into this problem in a certain model. Of course, it could also be a hint that a alternative parametrization might be preferable.

$\endgroup$
3
  • $\begingroup$ I understand that part. More depth = more gradients, more compute time. I'm wondering how many saturations is problematic. $\endgroup$ Aug 9, 2017 at 14:18
  • 5
    $\begingroup$ I think >0 is problematic, because it is an indication that there might be a region of the posterior that the sampler is not reaching. If there is a tiny region of the posterior that has any chance of reaching another part of the posterior, then you might get very few warnings, but it might still be a huge problem. That is as far as my understanding goes, but I am not a super-specialist in NUTS or Hamiltonian Monte Carlo like the guys that working on the Stan development team. Thus, if it is too challenging to avoid all cases, it may be worth to check on discourse.mc-stan.org/, too. $\endgroup$
    – Björn
    Aug 9, 2017 at 15:06
  • 2
    $\begingroup$ Based on recent discussions I now have the impression that (assuming there's no nasty problems) you are sampling nicely and efficiently, if you do not hit the tree depth limit. If you do hit it, you may sometimes just be sampling inefficiently (and really everything may be fine, other than maybe a bit too much auto-correlation) and in some older versions of Stan there was apparently an issue with the warning (i.e. it may have occurred when it should not have and you may have had perfectly nice draws from the posterior). $\endgroup$
    – Björn
    Feb 20, 2020 at 10:44
8
$\begingroup$

I'll leave this as an "answer" as I don't have enough reputation to "comment" on this post.

This webpage might be of interest to you.

The development team describses here, although quite shortly, the main implications and solutions to warnings in STAN. Reaching the Maximum treedetph is, according to their explanation, far less an issue than divergent transitions, as you'll get still valid samples from the posterior (which is not the case in the presence of divergent transitions).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.