Skip to content

Commit f249f12

Browse files
juanitorduzricardoV94
authored andcommitted
Graduate fgraph functionality from pymc-experimental
1 parent dfb05b6 commit f249f12

22 files changed

+1696
-15
lines changed

Diff for: .github/workflows/tests.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ jobs:
9393
tests/gp/test_gp.py
9494
tests/gp/test_mean.py
9595
tests/gp/test_util.py
96-
tests/test_model.py
96+
tests/model/test_core.py
97+
tests/model/test_fgraph.py
98+
tests/model/transform/test_basic.py
99+
tests/model/transform/test_conditioning.py
97100
tests/test_model_graph.py
98101
tests/ode/test_ode.py
99102
tests/ode/test_utils.py
@@ -187,7 +190,7 @@ jobs:
187190
python-version: ["3.9"]
188191
test-subset:
189192
- tests/variational/test_approximations.py tests/variational/test_callbacks.py tests/variational/test_inference.py tests/variational/test_opvi.py tests/test_initial_point.py
190-
- tests/test_model.py tests/sampling/test_mcmc.py
193+
- tests/model/test_core.py tests/sampling/test_mcmc.py
191194
- tests/gp/test_cov.py tests/gp/test_gp.py tests/gp/test_mean.py tests/gp/test_util.py tests/ode/test_ode.py tests/ode/test_utils.py tests/smc/test_smc.py tests/sampling/test_parallel.py
192195
- tests/step_methods/test_metropolis.py tests/step_methods/test_slicer.py tests/step_methods/hmc/test_nuts.py tests/step_methods/test_compound.py tests/step_methods/hmc/test_hmc.py
193196

@@ -266,7 +269,7 @@ jobs:
266269
tests/sampling/test_parallel.py
267270
tests/test_data.py
268271
tests/variational/test_minibatch_rv.py
269-
tests/test_model.py
272+
tests/model/test_core.py
270273
271274
- |
272275
tests/sampling/test_mcmc.py

Diff for: docs/source/api.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ API
99

1010
api/distributions
1111
api/gp
12-
api/model
12+
api/model/core
13+
api/model/fgraph
14+
api/model/transform/conditioning
1315
api/samplers
1416
api/vi
1517
api/smc

Diff for: docs/source/api/model.rst renamed to docs/source/api/model/core.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Model
44
Model creation and inspection
55
-----------------------------
66

7-
.. currentmodule:: pymc
7+
.. currentmodule:: pymc.model.core
88
.. autosummary::
99
:toctree: generated/
1010

Diff for: docs/source/api/model/fgraph.rst

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FunctionGraph
2+
-------------
3+
4+
.. currentmodule:: pymc.model.fgraph
5+
.. autosummary::
6+
:toctree: generated/
7+
8+
clone_model
9+
fgraph_from_model
10+
model_from_fgraph

Diff for: docs/source/api/model/transform/conditioning.rst

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Model Conditioning
2+
------------------
3+
4+
.. currentmodule:: pymc.model.transform.conditioning
5+
.. autosummary::
6+
:toctree: generated/
7+
8+
do
9+
observe
10+
11+
Others
12+
------
13+
14+
.. autosummary::
15+
:toctree: generated/
16+
17+
change_value_transforms
18+
remove_value_transforms

Diff for: docs/source/contributing/running_the_test_suite.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Therefore, we recommend to run just specific tests that target the parts of the
1919

2020
To run all tests from a single file:
2121
```bash
22-
pytest -v tests/test_model.py
22+
pytest -v tests/model/test_core.py
2323
```
2424

2525
```{tip}
@@ -28,10 +28,10 @@ The `-v` flag is short-hand for `--verbose` and prints the names of the test cas
2828

2929
Often, you'll want to focus on just a few test cases first.
3030
By using the `-k` flag, you can filter for test cases that match a certain pattern.
31-
For example, the following command runs all test cases from `test_model.py` that have "coord" in their name:
31+
For example, the following command runs all test cases from `test_core.py` that have "coord" in their name:
3232

3333
```bash
34-
pytest -v tests/test_model.py -k coord
34+
pytest -v tests/model/test_core.py -k coord
3535
```
3636

3737

Diff for: pymc/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ def __set_compiler_flags():
6363
logsumexp,
6464
probit,
6565
)
66-
from pymc.model import *
66+
from pymc.model.core import *
67+
from pymc.model.transform.conditioning import do, observe
6768
from pymc.model_graph import model_to_graphviz, model_to_networkx
6869
from pymc.plots import *
6970
from pymc.printing import *

Diff for: pymc/distributions/distribution.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
from pymc.logprob.abstract import MeasurableVariable, _icdf, _logcdf, _logprob
5454
from pymc.logprob.basic import logp
5555
from pymc.logprob.rewriting import logprob_rewrites_db
56-
from pymc.model import new_or_existing_block_model_access
56+
from pymc.model.core import new_or_existing_block_model_access
5757
from pymc.printing import str_for_dist
5858
from pymc.pytensorf import (
5959
collect_default_updates,

Diff for: pymc/model/__init__.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2023 The PyMC Developers
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
from pymc.model.core import *
15+
from pymc.model.core import ValueGradFunction

Diff for: pymc/model.py renamed to pymc/model/core.py

File renamed without changes.

0 commit comments

Comments
 (0)