Skip to content

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

@michaelosthege

Description

@michaelosthege
Member

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

Activity

ricardoV94

ricardoV94 commented on Apr 23, 2021

@ricardoV94
Member

What kind of things would go in here?

michaelosthege

michaelosthege commented on Apr 23, 2021

@michaelosthege
MemberAuthor
  • 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

OriolAbril commented on Apr 23, 2021

@OriolAbril
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

twiecki commented on Apr 24, 2021

@twiecki
Member

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

michaelosthege

michaelosthege commented on Apr 24, 2021

@michaelosthege
MemberAuthor

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

OriolAbril commented on Apr 24, 2021

@OriolAbril
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

michaelosthege commented on Apr 25, 2021

@michaelosthege
MemberAuthor

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

ferrine commented on Mar 30, 2022

@ferrine
Member

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

changed the title [-][Discussion] Introduce `rcParams` for global config settings[/-] [+]Introduce `pm.config` or `rcParams` for global & local config settings[/+] on Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @twiecki@michaelosthege@ferrine@OriolAbril@ricardoV94

        Issue actions

          Introduce `pm.config` or `rcParams` for global & local config settings · Issue #4657 · pymc-devs/pymc