Skip to content

Allow passing dims to Potential and Deterministic #6576

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

Merged
merged 3 commits into from
Mar 10, 2023

Conversation

Raj-Parekh24
Copy link
Contributor

@Raj-Parekh24 Raj-Parekh24 commented Mar 7, 2023

What is this PR about?
Closes #6544.

Checklist

Major / Breaking Changes

  • ...

New features

  • Add dims parameter in Potential function defined in the model.py file.

Bugfixes

  • ...

Documentation

  • ...

Maintenance

  • ...

@ricardoV94
Copy link
Member

ricardoV94 commented Mar 8, 2023

Thanks @Raj-Parekh24

Can you add a test that confirms dims are saved in "model.named_vars_to_dims”?

There must be a test that already checks this for deterministics, so you can put it nearby (probably in test_model.py).

@codecov
Copy link

codecov bot commented Mar 8, 2023

Codecov Report

Merging #6576 (1526261) into main (e76bba9) will increase coverage by 7.55%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6576      +/-   ##
==========================================
+ Coverage   84.45%   92.01%   +7.55%     
==========================================
  Files          91       92       +1     
  Lines       15108    15535     +427     
==========================================
+ Hits        12760    14294    +1534     
+ Misses       2348     1241    -1107     
Impacted Files Coverage Δ
pymc/model.py 89.52% <100.00%> (ø)

... and 31 files with indirect coverage changes

@Raj-Parekh24
Copy link
Contributor Author

Sure @ricardoV94 ,

I will look into it and add appropriate test case.

@Raj-Parekh24
Copy link
Contributor Author

Hi @ricardoV94,

Added test case "test_potential_with_dims" to check the dims passing to Potential please review it.

"""
with pm.Model(coords={"observed": range(10)}) as model:
x = pm.Normal("x", 0, 1)
y = pm.Deterministic("y", x**2, dims=("observed",))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test does not use Potential

Copy link
Contributor Author

@Raj-Parekh24 Raj-Parekh24 Mar 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the review @michaelosthege

Sorry for this,

I found that dims test case was not available for deterministic as well so added that test case along with potential.

I might forget to update the test case for potential.

I have updated the code.

Please review it.

@Raj-Parekh24 Raj-Parekh24 changed the title Allow passing dims to Potential Allow passing dims to Potential and Deterministic Mar 9, 2023
Copy link
Member

@ricardoV94 ricardoV94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Raj-Parekh24

@michaelosthege michaelosthege merged commit cf6d4ce into pymc-devs:main Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow passing dims to Potential
3 participants