# QuadPotentialFullAdapt

**URL:** <https://discourse.pymc.io/t/quadpotentialfulladapt/9728>\
**Category:** v5\
**Created:** [June 23, 2022, 10:03pm UTC](https://discourse.pymc.io/t/quadpotentialfulladapt/9728 "2022-06-23T22:03:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![aarcher](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/aarcher/32/4704_2.png) [@aarcher](https://discourse.pymc.io/u/aarcher)\
**Post date:** [June 23, 2022, 10:03pm UTC](https://discourse.pymc.io/t/quadpotentialfulladapt/9728/1 "2022-06-23T22:03:41Z")

</div>

Hi,

I’ve gotten larger effective samples sizes and fewer number of divergences when using jitter+adapt\_full than jitter+adapt\_diag. However, I’m a bit nervous about using jitter+adapt\_full because of the warning “QuadPotentialFullAdapt is an experimental feature.” Is it possible for anyone to speak more about QuadPotentialFullAdapt and potential pitfalls in using this feature?

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![ricardoV94](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/ricardov94/32/5775_2.png) [@ricardoV94](https://discourse.pymc.io/u/ricardoV94)\
**Post date:** [June 24, 2022, 6:34am UTC](https://discourse.pymc.io/t/quadpotentialfulladapt/9728/2 "2022-06-24T06:34:03Z")

</div>

If you want to try something more experimental and even better, have a look at `jitter+adapt_diag_grad` [pymc.init\_nuts — PyMC dev documentation](https://docs.pymc.io/en/latest/api/generated/pymc.init_nuts.html)

For your general question, perhaps @aseyboldt can clarify you.

---

<div class="post-metadata">

**Author:** ![aseyboldt](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/aseyboldt/32/5795_2.png) [@aseyboldt](https://discourse.pymc.io/u/aseyboldt)\
**Post date:** [June 24, 2022, 7:52am UTC](https://discourse.pymc.io/t/quadpotentialfulladapt/9728/3 "2022-06-24T07:52:34Z")

</div>

Full mass matrix adaptation is not somehow dangerous, maybe we should actually get rid of that warning by now. Just keep in mind that this doesn’t scale well to high dimensional cases. (At least in the current implementation).  
We might want to change the exact tuning behavior of that method relatively soon however, I’d hope that it only gets better if we do so though. 🙂

Because Ricardo mentioned it:  
There are a couple of other mass matrix adaptation methods that I’m working on. For one, `jitter+adapt_diag_grad`. As far as I currently understand things, this is usually better than our default, at least in terms of effective sample size per number of gradient evaluations. Just like the default this also scales well to high dimensions. It still only adapts a diagonal mass matrix, so it can’t really solve cases with high correlations that much better than the default, and in a low dimensional setting jitter+adapt\_full might still be better.  
For the high dimensional case there is a completely new mass matrix adaptation algorithm in [covadapt](https://github.com/aseyboldt/covadapt/blob/master/notebooks/covadapt_intro.ipynb) (cell 14), this really is very experimental though.  
In addition, there’s also a slightly modified implementation of `jitter+adapt_diag_grad` in [nutpie](https://github.com/aseyboldt/nutpie) that should converge faster to the same thing that `jitter+adapt_diag_grad` does.

---

<div class="post-metadata">

**Author:** ![jessegrabowski](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/jessegrabowski/32/5010_2.png) [@jessegrabowski](https://discourse.pymc.io/u/jessegrabowski)\
**Post date:** [June 24, 2022, 9:02am UTC](https://discourse.pymc.io/t/quadpotentialfulladapt/9728/4 "2022-06-24T09:02:51Z")

</div>

Maybe a naive question, but why isn’t there more freedom to “mix and match” the components of initialization methods for NUTS? It seems like all the available initialization methods boil down to some method of initializing the mass matrix (initial values, initial values + jitter, or ADVI), paired with a Potential function (diag, full, diag\_grad). Is there any reason why one couldn’t (or shouldn’t) start with the ADVI diagonal and run adapt\_diag\_grad, or why use SVGD or Normalizing Flows instead of ADVI to get an initial diagonal estimate?

---

<div class="post-metadata">

**Author:** ![junpenglao](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/junpenglao/32/8_2.png) [@junpenglao](https://discourse.pymc.io/u/junpenglao)\
**Post date:** [June 24, 2022, 9:19am UTC](https://discourse.pymc.io/t/quadpotentialfulladapt/9728/5 "2022-06-24T09:19:22Z")

</div>

In the past we are using ADVI as default, but that turns out does not work as well. So more focus now is using Stan-like window adaptation, but with different strategy of how we estimate the covariance (mass matrix) of the posterior during warmup.  
But that could also be that we have not spend enough effort to test out these ideas! For example, even with quasi-Newton algorithm there are some new idea that might improve tuning (i.e., [Pathfinder](https://statmodeling.stat.columbia.edu/2021/08/10/pathfinder-a-parallel-quasi-newton-algorithm-for-reaching-regions-of-high-probability-mass/))

---

<div class="post-metadata">

**Author:** ![jessegrabowski](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/jessegrabowski/32/5010_2.png) [@jessegrabowski](https://discourse.pymc.io/u/jessegrabowski)\
**Post date:** [June 24, 2022, 9:44am UTC](https://discourse.pymc.io/t/quadpotentialfulladapt/9728/6 "2022-06-24T09:44:26Z")

</div>

I’ve had success with using ADVI in models where the parameter space is somewhat constrained, directly modeling probabilities where all observations were small (\<0.05) with a LogitNormal. Using jitter caused chains to fail, while ADVI went smooth. I’d say it’s a nice tool to have, even if it’s not a nice default.

I guess my question is more theoretical than practical – there are several ways to initialize the mass matrix, and several potential functions. Aside from wanting to avoid analysis paralysis, is there any reason why a user shouldn’t be able to try the full combinatorial range of options?

---

<div class="post-metadata">

**Author:** ![aarcher](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/aarcher/32/4704_2.png) [@aarcher](https://discourse.pymc.io/u/aarcher)\
**Post date:** [June 24, 2022, 3:24pm UTC](https://discourse.pymc.io/t/quadpotentialfulladapt/9728/7 "2022-06-24T15:24:00Z")

</div>

Thank you all for your detailed response and interesting discussion! I’ll let you know if I have any more questions.

---

<div class="post-metadata">

**Author:** ![qipengchen](https://avatars.discourse-cdn.com/v4/letter/q/65b543/32.png) [@qipengchen](https://discourse.pymc.io/u/qipengchen)\
**Post date:** [July 2, 2022, 2:46am UTC](https://discourse.pymc.io/t/quadpotentialfulladapt/9728/8 "2022-07-02T02:46:37Z")

</div>

Hi, do you have any reference recommendations on the `advi+adapt_diag` initialization method? I recently used `jitter+adapt_diag` as the initialization method, however, it causes the chain failed, but `advi+adapt_diag` works fine instead. I would like to know more about the advantages and disadvantages of advi as an initialization method. Thanks a lot !
