Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce pm.config or rcParams for global & local config settings #4657

Open
Tracked by #7053
michaelosthege opened this issue Apr 21, 2021 · 8 comments
Open
Tracked by #7053

Comments

@michaelosthege
Copy link
Member

michaelosthege commented Apr 21, 2021

Let me begin with saying that global variables are evil and nobody should be using them.

For things like #4372 it would be really useful to have a place where to make global config changes.
Matplotlib does it and ArviZ too.
Aesara also has a quite powerful config implementation that I refactored quite a bit a few months back.
Or maybe we don't even need/want a place for global configuration settings?

Anyways it would be great to discuss and figure out what we want!

Update 2022-03-30 + ToDo

We have a general consensus that we want to do this. (I'm updating the title+labels in a second.)

Whoever wants to work on this should

  1. Read this thread
  2. Specifically investigate the options here
  3. Decide which route to go for
  4. Open a PR
@ricardoV94
Copy link
Member

What kind of things would go in here?

@michaelosthege
Copy link
Member Author

  • Switching the return_inferencedata default value
  • Turning the automatic addition of SpecifyShape when full-length shape is passed on/off
  • Default values for compute_convergence_checks or discard_tuned_samples maybe?

@OriolAbril
Copy link
Member

  • default init in sample, and anything else where we have a "you can't trust the default to stay the same"
  • keep_size ? for people who wants to live in the past and get flattened samples in sample_posterior_predictive after Set keep_size=True in v4 #4647
  • going forward not sure if it should be here or in Aesara, default sampling backend, jax, numba, python samples if still around

@twiecki
Copy link
Member

twiecki commented Apr 24, 2021

I like it, I often use a default-dict for the sample() kwargs.

@michaelosthege
Copy link
Member Author

michaelosthege commented Apr 24, 2021

Sounds like we are in favor of global config settings.
So how should we implement it?

Option 1: rcParams

➕ Users know it from matplotlib and arviz
➕ Can change options with context managers (I didn't know that - thanks @OriolAbril !)
➖ Mix of two different config schemes (Aesara vs. PyMC3)

Option 2: aesara.configparser

➕ Users know it from theano/aesara
➕ Can change options with context managers
➕ Can work with CLI params/environment variables
➖ Mix of two different config schemes (Aesara+PyMC3 vs. ArviZ)

Feel free to edit this comment to add/edit the ➕/➖ items.

@OriolAbril
Copy link
Member

I'd go with whatever is easier to add and maintain. ArviZ/matplotlib version has no dependencies because it has the reader and rcparams object as part of the codebase.

Also not sure what you mean by always global in the matplotlib/arviz one, both can be configured temporarly with context managers.

@michaelosthege
Copy link
Member Author

After looking at the size of the ArviZ rcParams implementation 😮 I'd actually recommend the Aesara configparser.
It comes down to copyediting the following:

@ferrine
Copy link
Member

ferrine commented Mar 30, 2022

I like the idea. There should also be a way to make temporary changes in a context manager like done in matplotlib

@michaelosthege michaelosthege changed the title [Discussion] Introduce rcParams for global config settings Introduce pm.config or rcParams for global & local config settings Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants