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

Allow interdependent initial points from same OpFromGraph node #7569

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ricardoV94
Copy link
Member

@ricardoV94 ricardoV94 commented Nov 11, 2024

This is needed to allow proper initival support of Marginalized variables in pymc-devs/pymc-experimental#388, where multiple interdependent variables may become collapsed in a single node. We want initial values replacements to still propagate across these dependencies.

To achieve that the initial point machinery now makes use of toposort_replace (instead of assuming model variables are provided in a topological order) and the utility itself is expanded to untie variables coming from the same OpFromGraph node


📚 Documentation preview 📚: https://pymc--7569.org.readthedocs.build/en/7569/

It is not part of the API that variables must be registered in topological order
Copy link

codecov bot commented Nov 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.83%. Comparing base (a507ea8) to head (285263d).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #7569   +/-   ##
=======================================
  Coverage   92.83%   92.83%           
=======================================
  Files         106      106           
  Lines       17669    17681   +12     
=======================================
+ Hits        16403    16415   +12     
  Misses       1266     1266           
Files with missing lines Coverage Δ
pymc/initial_point.py 99.02% <100.00%> (-0.01%) ⬇️
pymc/pytensorf.py 90.90% <100.00%> (+0.28%) ⬆️

Copy link
Contributor

@zaxtax zaxtax left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -187,6 +193,40 @@ def test_string_overrides_work(self):
assert np.isclose(iv["B_log__"], 0)
assert iv["C_log__"] == 0

@pytest.mark.parametrize("reverse_rvs", [False, True])
def test_dependent_initval_from_OFG(self, reverse_rvs):
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this test indicative of why this features is need for the other PR?

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.

2 participants