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

Diagnostics: partitioning filtering and naming #260

Merged
merged 43 commits into from
Dec 2, 2024
Merged

Conversation

jerrymhuang
Copy link
Collaborator

@jerrymhuang jerrymhuang commented Nov 26, 2024

Give users the ability to rename their variables through separating the filtering and naming processes in dict_to_arrays and preprocess.

Related to #257 .

jerrymhuang and others added 30 commits November 3, 2024 22:16
@jerrymhuang jerrymhuang added feature New feature or request refactoring Some code shall be redesigned user interface Changes to the user interface and improvements in usability labels Nov 26, 2024
@jerrymhuang jerrymhuang added this to the BayesFlow 2.0 milestone Nov 26, 2024
@jerrymhuang jerrymhuang self-assigned this Nov 26, 2024
@paul-buerkner
Copy link
Contributor

thank you! Could you please provide a small code example for how users would use this new feature?

@jerrymhuang jerrymhuang marked this pull request as ready for review November 29, 2024 20:39
@jerrymhuang
Copy link
Collaborator Author

Update: the partitioning between filtering and naming is now even clearer!

Here are two examples of the updated usage for diagnostics (as already indicated in the Linear Regression notebook):

Example 1: plot_samples_2d

# Let's say we only want to plot the beta prior samples...
filter_keys = ['beta']
variable_names = [r"$\beta_0$", r"$\beta_1$"]

f = bf.diagnostics.plot_samples_2d(
    samples=prior_samples, 
    filter_keys=filter_keys, 
    variable_names=variable_names,
    context="Prior"
)

Example 2: plot_recovery

# Let's say later we want to plot recovery for all parameters...
filter_keys = ['beta', 'sigma']
variable_names = [r"$\beta_0$", r"$\beta_1$", r"$\sigma$"]

f = bf.diagnostics.plot_recovery(
    post_samples=pdraws,
    prior_samples=val_sims,
    filter_keys=filter_keys,
    variable_names=variable_names
)

The above examples are streamlined to all diagnostics utilities that require preprocess.

@stefanradev93 stefanradev93 merged commit 0c1c9bc into dev Dec 2, 2024
13 checks passed
@stefanradev93 stefanradev93 deleted the diagnostics branch December 2, 2024 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request refactoring Some code shall be redesigned user interface Changes to the user interface and improvements in usability
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants