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

Port do and observe functions from PyMC-Experimental #6879

Merged
merged 1 commit into from
Sep 4, 2023

Conversation

juanitorduz
Copy link
Contributor

@juanitorduz juanitorduz commented Aug 28, 2023

@ricardoV94
Copy link
Member

ricardoV94 commented Aug 28, 2023

I removed the "closes", because we will need a PR that deprecates the functionality in pymc_experimental in favor of pymc

@ricardoV94
Copy link
Member

ricardoV94 commented Aug 28, 2023

Let's do the following: rename model/model.py to model/basic.py. Keep all public variables that were present in model.py available in model.__init__.py (so existing code isn't broken)

@codecov
Copy link

codecov bot commented Aug 28, 2023

Codecov Report

Merging #6879 (dc4b774) into main (dfb05b6) will increase coverage by 0.08%.
The diff coverage is 95.76%.

❗ Current head dc4b774 differs from pull request most recent head 404ba19. Consider uploading reports for the commit 404ba19 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    pymc-devs/pymc#6879      +/-   ##
==========================================
+ Coverage   92.05%   92.14%   +0.08%     
==========================================
  Files          96      100       +4     
  Lines       16446    16796     +350     
==========================================
+ Hits        15140    15476     +336     
- Misses       1306     1320      +14     
Files Changed Coverage Δ
pymc/model/core.py 91.29% <ø> (ø)
pymc/pytensorf.py 92.17% <85.71%> (-0.59%) ⬇️
pymc/model/transform/basic.py 95.00% <95.00%> (ø)
pymc/model/transform/conditioning.py 96.03% <96.03%> (ø)
pymc/model/fgraph.py 96.89% <96.89%> (ø)
pymc/__init__.py 100.00% <100.00%> (ø)
pymc/backends/__init__.py 89.18% <100.00%> (ø)
pymc/backends/arviz.py 96.48% <100.00%> (ø)
pymc/backends/base.py 85.83% <100.00%> (ø)
pymc/backends/mcbackend.py 100.00% <100.00%> (ø)
... and 21 more

@twiecki
Copy link
Member

twiecki commented Aug 28, 2023

How about model/core.py (formerly model.py), model/transform.py and model/fgraph.py?

@juanitorduz
Copy link
Contributor Author

How about model/core.py (formerly model.py), model/transform.py and model/fgraph.py?

I am easy! Just provide your feedback and I will change it accordingly :)

@ricardoV94
Copy link
Member

transform should be a submodule. We want to implement many things, and the file would become messy quickly

@twiecki
Copy link
Member

twiecki commented Aug 28, 2023

transform should be a submodule. We want to implement many things, and the file would become messy quickly

Sure, just model/transform/ then

@ricardoV94
Copy link
Member

ricardoV94 commented Aug 28, 2023

A good check that you are not breaking anything is to not change any of the imports in tests (things should be importable from the same "path" after your PR).

@juanitorduz
Copy link
Contributor Author

juanitorduz commented Aug 28, 2023

A good check that you are not breaking anything is to not change any of the imports in tests (things should be importable from the same "path" after your PR).

Yes! Thanks for the feedback! I will revert and fix the last commit which does exactly that 😅

@juanitorduz
Copy link
Contributor Author

@ricardoV94, while I fix the mypy errors (yay!)... I would appreciate feedback on the new module structure (all tests are passing now). Thanks :)

@juanitorduz juanitorduz marked this pull request as ready for review August 28, 2023 20:30
pymc/model/fgraph.py Outdated Show resolved Hide resolved
@ricardoV94
Copy link
Member

Just a small refactor suggestion, otherwise looks great!

@ricardoV94 ricardoV94 changed the title Port Do-Operator Code from PyMC-Experimental Port Do and Observe Operations from PyMC-Experimental Aug 29, 2023
@ricardoV94
Copy link
Member

ricardoV94 commented Aug 29, 2023

Ah we also need to list the new functionality in the docs! And make sure that we show the old model stuff now that the paths have changed

@juanitorduz
Copy link
Contributor Author

Ah we also need to list the new functionality in the docs! And make sure that we show the old model stuff now that the paths have changed

What exactly do I need to change? Is there an example PR?

@ricardoV94
Copy link
Member

I don't know about a template PR. The goal is for the functionality to be discoverable in the API docs: https://pymcio--6879.org.readthedocs.build/projects/docs/en/6879/api.html

Just need to add some entries in the docs indexes, somewhere here: https://github.com/pymc-devs/pymc/tree/main/docs/source/api

This may be useful: https://www.pymc.io/projects/docs/en/stable/contributing/build_docs.html

@juanitorduz
Copy link
Contributor Author

juanitorduz commented Aug 30, 2023

@ricardoV94 I tried changing the structure in the docs but I am not seeing this locally (see adde6d2). I will need some support here 🙏

@juanitorduz
Copy link
Contributor Author

juanitorduz commented Aug 30, 2023

@juanitorduz
Copy link
Contributor Author

juanitorduz commented Aug 30, 2023

Ok! I think 96e6c2b fixed the API entry page.

image

@twiecki
Copy link
Member

twiecki commented Aug 30, 2023

Just making sure we're making this available from the global namespace so that we can do pm.do and pm.observe?

@juanitorduz
Copy link
Contributor Author

Just making sure we're making this available from the global namespace so that we can do pm.do and pm.observe?

They should be available after 2fa700b

pymc/pytensorf.py Outdated Show resolved Hide resolved
pymc/__init__.py Outdated Show resolved Hide resolved
docs/source/api/model/transform/conditioning.rst Outdated Show resolved Hide resolved
@twiecki twiecki changed the title Port Do and Observe Operations from PyMC-Experimental Port do() and observe() functions from PyMC-Experimental Aug 30, 2023
@ricardoV94 ricardoV94 changed the title Port do() and observe() functions from PyMC-Experimental Port do and observe functions from PyMC-Experimental Sep 4, 2023
@ricardoV94
Copy link
Member

ricardoV94 commented Sep 4, 2023

I pushed the following changes:

  • Reverted changes in imports, so the PR shows less changes
  • Updated docstring examples that still showed pymc_experimental imports
  • Added __all__ to the new modules
  • Rebased from main

Should be good to go when tests pass

@juanitorduz
Copy link
Contributor Author

Thank you very much @ricardoV94 😀 !

@ricardoV94 ricardoV94 merged commit f249f12 into pymc-devs:main Sep 4, 2023
21 checks passed
@juanitorduz juanitorduz deleted the do_operator_issue_6878 branch September 4, 2023 09:54
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.

Numerical differences between 3.11.4 and 4.0.0b
3 participants