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

Create arrow to observation nodes subject to arbitrary dtype casting in pm.model_to_graphviz #6011

Merged
merged 6 commits into from
Jul 26, 2022

Conversation

larryshamalama
Copy link
Member

Closes #5795.

As described in the issue, when casting data to another dtype, a casting operation is performed and ignored by the pm.model_to_graphviz functionality.

However, without investigating further, I believe that this PR covers the scope of #5795, but there is an important example of another problem which seems to be caused by a different issue. I hope to have a look at the latter this Wednesday.

CC @drbenvincent

@codecov
Copy link

codecov bot commented Jul 25, 2022

Codecov Report

Merging #6011 (7982b80) into main (73eac98) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6011      +/-   ##
==========================================
+ Coverage   89.15%   89.17%   +0.01%     
==========================================
  Files          72       72              
  Lines       12895    12900       +5     
==========================================
+ Hits        11496    11503       +7     
+ Misses       1399     1397       -2     
Impacted Files Coverage Δ
pymc/model_graph.py 95.45% <100.00%> (+1.75%) ⬆️

pymc/model_graph.py Outdated Show resolved Hide resolved
@twiecki
Copy link
Member

twiecki commented Jul 26, 2022

@larryshamalama Would be great to get this one over the finish line for the new release!

pymc/model_graph.py Outdated Show resolved Hide resolved
@@ -236,6 +256,10 @@ class TestUnnamedObservedNodes(BaseModelGraphTest):
model_func = model_unnamed_observed_node


class TestObservationDtypeCasting(BaseModelGraphTest):
model_func = model_observation_dtype_casting
Copy link
Member

Choose a reason for hiding this comment

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

Why not just add the function here into the class directly?

Copy link
Member Author

Choose a reason for hiding this comment

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

I just naively followed the structure of previous tests based on BaseModelGraphTest...

Copy link
Member

@canyon289 canyon289 Jul 26, 2022

Choose a reason for hiding this comment

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

Thanks, I see that now that I expanded past diffs. Dont worry about it on this PR, ill just openly say I dont believe this is the right pattern, it very much feels like we should be using fixtures to reference model setup blocks as pytest provides many more functionality and guarantees when we use its architecture correctly

Thanks for the PR!

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not super familiar with the alternative approach that you're proposing. Maybe it could be something to improve at a later date. In short, what do you mean by using fixtures and why does it allow better usage of pytest? Is this page what you are referring to? I'm going to guess that the answer to this is beyond the scope of this PR and can warrant a whole discussion...

@canyon289
Copy link
Member

Thanks @larryshamalama for providing this. Before we merge can we rebase on main as well so it gets tested by our 3.7 test runners that just got added?

@larryshamalama larryshamalama marked this pull request as draft July 26, 2022 14:05
@larryshamalama
Copy link
Member Author

larryshamalama commented Jul 26, 2022

Need a moment to fix another bug, marking this as draft temporarily

Edit: fixed! With this PR merged, @drbenvincent's notebook should display the right graph

@larryshamalama larryshamalama marked this pull request as ready for review July 26, 2022 14:18
@larryshamalama larryshamalama changed the title Create arrow to ConstantData observation nodes in pm.model_to_graphviz Create arrow to observation nodes subject to arbitrary dtype casting in pm.model_to_graphviz Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Graphviz does not properly show observed ConstantData when subjected to intermediate Ops
4 participants