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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ jobs:
tests/gp/test_gp.py
tests/gp/test_mean.py
tests/gp/test_util.py
tests/test_model.py
tests/model/test_core.py
tests/model/test_fgraph.py
tests/model/transform/test_basic.py
tests/model/transform/test_conditioning.py
tests/test_model_graph.py
tests/ode/test_ode.py
tests/ode/test_utils.py
Expand Down Expand Up @@ -187,7 +190,7 @@ jobs:
python-version: ["3.9"]
test-subset:
- 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
- tests/test_model.py tests/sampling/test_mcmc.py
- tests/model/test_core.py tests/sampling/test_mcmc.py
- 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
- 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

Expand Down Expand Up @@ -266,7 +269,7 @@ jobs:
tests/sampling/test_parallel.py
tests/test_data.py
tests/variational/test_minibatch_rv.py
tests/test_model.py
tests/model/test_core.py

- |
tests/sampling/test_mcmc.py
Expand Down
4 changes: 3 additions & 1 deletion docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ API

api/distributions
api/gp
api/model
api/model/core
api/model/fgraph
api/model/transform/conditioning
api/samplers
api/vi
api/smc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Model
Model creation and inspection
-----------------------------

.. currentmodule:: pymc
.. currentmodule:: pymc.model.core
.. autosummary::
:toctree: generated/

Expand Down
10 changes: 10 additions & 0 deletions docs/source/api/model/fgraph.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FunctionGraph
-------------

.. currentmodule:: pymc.model.fgraph
.. autosummary::
:toctree: generated/

clone_model
fgraph_from_model
model_from_fgraph
18 changes: 18 additions & 0 deletions docs/source/api/model/transform/conditioning.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Model Conditioning
juanitorduz marked this conversation as resolved.
Show resolved Hide resolved
------------------

.. currentmodule:: pymc.model.transform.conditioning
.. autosummary::
:toctree: generated/

do
observe

Others
------

.. autosummary::
:toctree: generated/

change_value_transforms
remove_value_transforms
6 changes: 3 additions & 3 deletions docs/source/contributing/running_the_test_suite.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Therefore, we recommend to run just specific tests that target the parts of the

To run all tests from a single file:
```bash
pytest -v tests/test_model.py
pytest -v tests/model/test_core.py
```

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

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

```bash
pytest -v tests/test_model.py -k coord
pytest -v tests/model/test_core.py -k coord
```


Expand Down
3 changes: 2 additions & 1 deletion pymc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ def __set_compiler_flags():
logsumexp,
probit,
)
from pymc.model import *
from pymc.model.core import *
from pymc.model.transform.conditioning import do, observe
from pymc.model_graph import model_to_graphviz, model_to_networkx
from pymc.plots import *
from pymc.printing import *
Expand Down
2 changes: 1 addition & 1 deletion pymc/distributions/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
from pymc.logprob.abstract import MeasurableVariable, _icdf, _logcdf, _logprob
from pymc.logprob.basic import logp
from pymc.logprob.rewriting import logprob_rewrites_db
from pymc.model import new_or_existing_block_model_access
from pymc.model.core import new_or_existing_block_model_access
from pymc.printing import str_for_dist
from pymc.pytensorf import (
collect_default_updates,
Expand Down
15 changes: 15 additions & 0 deletions pymc/model/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2023 The PyMC Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from pymc.model.core import *
from pymc.model.core import ValueGradFunction
File renamed without changes.
Loading
Loading