pymc icon indicating copy to clipboard operation
pymc copied to clipboard

Default target_accept not mentioned anywhere in the docs

Open ricardoV94 opened this issue 1 year ago • 15 comments

Description

...

ricardoV94 avatar Aug 12 '24 15:08 ricardoV94

can you provide more info about this?

kdotmanoj avatar Aug 14 '24 07:08 kdotmanoj

can you provide more info about this?

I think it's pretty self explanatory.

ricardoV94 avatar Aug 14 '24 16:08 ricardoV94

It's a keyword argument to pm.sample

ricardoV94 avatar Aug 14 '24 16:08 ricardoV94

so the value is 0.8 right, found here:

image

i am finding it difficult to find where to edit as it is autogenerated from the code.

kdotmanoj avatar Aug 14 '24 18:08 kdotmanoj

so the value is 0.8 right, found here:

image

i am finding it difficult to find where to edit as it is autogenerated from the code.

You're looking at nutpie sample function not pymc

ricardoV94 avatar Aug 14 '24 19:08 ricardoV94

Is target_accept a kwarg to pm.sample() or just another **kwargs? The argument isn't even included in the API docs, so if it's the former, there's a bigger problem.

I mean, it's detailed here, but I assumed that the sampling defaults would be specified deeper in the code, possibly allowing for different default for different sampling algorithms.

cluhmann avatar Aug 15 '24 17:08 cluhmann

There are at least a couple places where a default is provided deep in the code:

https://github.com/pymc-devs/pymc/blob/747fda3192a5df90cf76bbce641a9542559548c8/pymc/sampling/mcmc.py#L730

https://github.com/pymc-devs/pymc/blob/747fda3192a5df90cf76bbce641a9542559548c8/pymc/sampling/jax.py#L478

https://github.com/pymc-devs/pymc/blob/747fda3192a5df90cf76bbce641a9542559548c8/pymc/step_methods/hmc/hmc.py#L119

https://github.com/pymc-devs/pymc/blob/747fda3192a5df90cf76bbce641a9542559548c8/pymc/step_methods/hmc/base_hmc.py#L72

Armavica avatar Aug 15 '24 17:08 Armavica

Exactly. But those are each specified separately and, it turns out, in a way that creates different defaults for different algorithms. So I'm not sure what's missing from the docs.

cluhmann avatar Aug 15 '24 18:08 cluhmann

Exactly. But those are each specified separately and, it turns out, in a way that creates different defaults for different algorithms. So I'm not sure what's missing from the docs.

I couldn't figure out what the default is as an advanced user. Since it's common advice to increase it (even automatic in case of divergences) it should be easy to find what the default is.

ricardoV94 avatar Aug 15 '24 21:08 ricardoV94

This is caused by pm.sample() being a franken-wrapper that dispatches to a bunch of actual sampling methods, but seems like it does something useful all on its own. Where would you expect the default value to be documented?

cluhmann avatar Aug 15 '24 21:08 cluhmann

pm.sample 🤷‍♂️🫠🥹? Or do you have a better idea?

ricardoV94 avatar Aug 15 '24 21:08 ricardoV94

But ... it's not an argument to pm.sample(). I do have a better idea, but you didn't like it (e.g., deprecate pm.sample). :joy:

cluhmann avatar Aug 16 '24 00:08 cluhmann

But ... it's not an argument to pm.sample(). I do have a better idea, but you didn't like it (e.g., deprecate pm.sample). :joy:

It is, just hidden inside **kwargs.

It's actually a special kwarg, the only one we accept both directly and as usual step kwargs

ricardoV94 avatar Aug 16 '24 03:08 ricardoV94

See https://github.com/pymc-devs/pymc/pull/5622

ricardoV94 avatar Aug 16 '24 03:08 ricardoV94

@ricardoV94 do you suggest mentioning the default values of target_accept here ?

kdotmanoj avatar Aug 16 '24 08:08 kdotmanoj