Skip to content

Commit 79c7e87

Browse files
authored
Merge branch 'master' into cover-choose-chains
2 parents 6d264f2 + 2a38198 commit 79c7e87

21 files changed

+301
-116
lines changed

.github/workflows/arviz_compat.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ${{ matrix.os }}
1919
env:
2020
TEST_SUBSET: ${{ matrix.test-subset }}
21-
THEANO_FLAGS: floatX=${{ matrix.floatx }},gcc.cxxflags='-march=native'
21+
THEANO_FLAGS: floatX=${{ matrix.floatx }},gcc__cxxflags='-march=native'
2222
defaults:
2323
run:
2424
shell: bash -l {0}
@@ -33,6 +33,18 @@ jobs:
3333
path: ~/conda_pkgs_dir
3434
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
3535
hashFiles('conda-envs/environment-dev-py38.yml') }}
36+
- name: Cache multiple paths
37+
uses: actions/cache@v2
38+
env:
39+
# Increase this value to reset cache if requirements.txt has not changed
40+
CACHE_NUMBER: 0
41+
with:
42+
path: |
43+
~/.cache/pip
44+
$RUNNER_TOOL_CACHE/Python/*
45+
~\AppData\Local\pip\Cache
46+
key: ${{ runner.os }}-build-${{ matrix.python-version }}-${{
47+
hashFiles('requirements.txt') }}
3648
- uses: conda-incubator/setup-miniconda@v2
3749
with:
3850
activate-environment: pymc3-dev-py38
@@ -47,7 +59,7 @@ jobs:
4759
- name: Install latest arviz
4860
run: |
4961
conda activate pymc3-dev-py38
50-
conda remove arviz -y
62+
pip uninstall arviz -y
5163
pip install git+git://github.com/arviz-devs/arviz.git
5264
- name: Run tests
5365
run: |

.github/workflows/pytest.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
--ignore=pymc3/tests/test_examples.py
2222
--ignore=pymc3/tests/test_gp.py
2323
--ignore=pymc3/tests/test_mixture.py
24+
--ignore=pymc3/tests/test_ode.py
2425
--ignore=pymc3/tests/test_parallel_sampling.py
2526
--ignore=pymc3/tests/test_posteriors.py
2627
--ignore=pymc3/tests/test_quadpotential.py
@@ -43,6 +44,7 @@ jobs:
4344
- |
4445
pymc3/tests/test_examples.py
4546
pymc3/tests/test_mixture.py
47+
pymc3/tests/test_ode.py
4648
pymc3/tests/test_posteriors.py
4749
pymc3/tests/test_quadpotential.py
4850
- |
@@ -59,7 +61,7 @@ jobs:
5961
runs-on: ${{ matrix.os }}
6062
env:
6163
TEST_SUBSET: ${{ matrix.test-subset }}
62-
THEANO_FLAGS: floatX=${{ matrix.floatx }},gcc.cxxflags='-march=native'
64+
THEANO_FLAGS: floatX=${{ matrix.floatx }},gcc__cxxflags='-march=native'
6365
defaults:
6466
run:
6567
shell: bash -l {0}
@@ -74,6 +76,18 @@ jobs:
7476
path: ~/conda_pkgs_dir
7577
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
7678
hashFiles('conda-envs/environment-dev-py36.yml') }}
79+
- name: Cache multiple paths
80+
uses: actions/cache@v2
81+
env:
82+
# Increase this value to reset cache if requirements.txt has not changed
83+
CACHE_NUMBER: 0
84+
with:
85+
path: |
86+
~/.cache/pip
87+
$RUNNER_TOOL_CACHE/Python/*
88+
~\AppData\Local\pip\Cache
89+
key: ${{ runner.os }}-build-${{ matrix.python-version }}-${{
90+
hashFiles('requirements.txt') }}
7791
- uses: conda-incubator/setup-miniconda@v2
7892
with:
7993
activate-environment: pymc3-dev-py36

.github/workflows/windows.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ${{ matrix.os }}
1818
env:
1919
TEST_SUBSET: ${{ matrix.test-subset }}
20-
THEANO_FLAGS: floatX=${{ matrix.floatx }},gcc.cxxflags='-march=core2'
20+
THEANO_FLAGS: floatX=${{ matrix.floatx }},gcc__cxxflags='-march=core2'
2121
defaults:
2222
run:
2323
shell: bash -l {0}
@@ -32,12 +32,29 @@ jobs:
3232
path: ~/conda_pkgs_dir
3333
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
3434
hashFiles('conda-envs/environment-dev-py37.yml') }}
35+
- name: Cache multiple paths
36+
uses: actions/cache@v2
37+
env:
38+
# Increase this value to reset cache if requirements.txt has not changed
39+
CACHE_NUMBER: 0
40+
with:
41+
path: |
42+
~/.cache/pip
43+
$RUNNER_TOOL_CACHE/Python/*
44+
~\AppData\Local\pip\Cache
45+
key: ${{ runner.os }}-build-${{ matrix.python-version }}-${{
46+
hashFiles('requirements.txt') }}
3547
- uses: conda-incubator/setup-miniconda@v2
3648
with:
3749
activate-environment: pymc3-dev-py37
3850
channel-priority: strict
3951
environment-file: conda-envs/environment-dev-py37.yml
4052
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
53+
- name: Install-pymc3
54+
run: |
55+
conda activate pymc3-dev-py37
56+
pip install -e .
57+
python --version
4158
- run: |
4259
conda activate pymc3-dev-py37
4360
python -m pytest -vv --cov=pymc3 --cov-report=xml --cov-report term --durations=50 $TEST_SUBSET

.pre-commit-config.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ repos:
1111
- id: no-commit-to-branch
1212
args: [--branch, master]
1313
- id: requirements-txt-fixer
14+
exclude: ^requirements-dev\.txt$
1415
- id: trailing-whitespace
1516
- repo: https://github.com/nbQA-dev/nbQA
1617
rev: 0.5.4
@@ -61,6 +62,19 @@ repos:
6162
language: python
6263
name: Check no tests are ignored
6364
pass_filenames: false
65+
- id: conda-env-sort
66+
additional_dependencies: [pyyaml]
67+
entry: python scripts/sort_conda_envs.py
68+
files: ^conda-envs/
69+
language: python
70+
name: Sort dependencies in conda envs
71+
types: [yaml]
72+
- id: pip-from-conda
73+
additional_dependencies: [pyyaml]
74+
entry: python scripts/generate_pip_deps_from_conda.py
75+
files: ^conda-envs/
76+
language: python
77+
name: Generate pip dependency from conda
6478
- id: no-relative-imports
6579
name: No relative imports
6680
entry: from \.[\.\w]* import

CONTRIBUTING.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ We appreciate being notified of problems with the existing PyMC code. We prefer
1515

1616
Please verify that your issue is not being currently addressed by other issues or pull requests by using the GitHub search tool to look for key words in the project issue tracker.
1717

18+
Filter on the ["beginner friendly"](https://github.com/pymc-devs/pymc3/issues?q=is%3Aopen+is%3Aissue+label%3A%22beginner+friendly%22) label for issues which are good for new contributors.
19+
1820
# Contributing code via pull requests
1921

2022
While issue reporting is valuable, we strongly encourage users who are inclined to do so to submit patches for new or existing issues via pull requests. This is particularly the case for simple fixes, such as typos or tweaks to documentation, which do not require a heavy investment of time and attention.
@@ -38,7 +40,7 @@ The preferred workflow for contributing to PyMC3 is to fork the [GitHub reposito
3840
3. Create a ``feature`` branch to hold your development changes:
3941

4042
```bash
41-
$ git switch -c my-feature
43+
$ git checkout -b my-feature
4244
```
4345

4446
Always use a ``feature`` branch. It's good practice to never routinely work on the ``master`` branch of any repository.
@@ -147,4 +149,6 @@ Follow [TensorFlow's style guide](https://www.tensorflow.org/community/contribut
147149

148150
For documentation strings, we *prefer* [numpy style](https://numpydoc.readthedocs.io/en/latest/format.html) to comply with the style that predominates in our upstream dependencies.
149151

152+
Finally, see the [PyMC3 Python Code Style](https://github.com/pymc-devs/pymc3/wiki/PyMC3-Python-Code-Style) and the [PyMC's Jupyter Notebook Style](https://github.com/pymc-devs/pymc3/wiki/PyMC's-Jupyter-Notebook-Style) guides.
153+
150154
#### This guide was derived from the [scikit-learn guide to contributing](https://github.com/scikit-learn/scikit-learn/blob/master/CONTRIBUTING.md)

RELEASE-NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Maintenance
66
- Fixed bug whereby partial traces returns after keyboard interrupt during parallel sampling had fewer draws than would've been available [#4318](https://github.com/pymc-devs/pymc3/pull/4318)
7+
- Make `sample_shape` same across all contexts in `draw_values` (see [#4305](https://github.com/pymc-devs/pymc3/pull/4305)).
78

89
## PyMC3 3.10.0 (7 December 2020)
910

conda-envs/environment-dev-py36.yml

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,22 @@
11
name: pymc3-dev-py36
22
channels:
3-
- conda-forge
4-
- defaults
3+
- conda-forge
4+
- defaults
55
dependencies:
6-
- python=3.6
7-
- arviz>=0.9
8-
- theano-pymc==1.0.11
9-
- numpy>=1.13
10-
- scipy>=0.18
11-
- pandas>=0.18
12-
- patsy>=0.5
13-
- fastprogress>=0.2
14-
- h5py>=2.7
15-
- typing-extensions>=3.7
16-
- python-graphviz
17-
- ipython>=7.16
18-
- nbsphinx>=0.4
19-
- numpydoc>=0.9
20-
- pre-commit>=2.8.0
21-
- pytest-cov>=2.5
22-
- pytest>=3.0
23-
- recommonmark>=0.4
24-
- sphinx-autobuild>=0.7
25-
- sphinx>=1.5
26-
- watermark
27-
- dataclasses # python_version < 3.7
28-
- contextvars # python_version < 3.7
29-
- mkl-service
30-
- dill
31-
- libblas=*=*mkl
6+
- contextvars
7+
- dataclasses
8+
- h5py>=2.7
9+
- ipython>=7.16
10+
- libblas=*=*mkl
11+
- mkl-service
12+
- nbsphinx>=0.4
13+
- numpydoc>=0.9
14+
- pre-commit>=2.8.0
15+
- pytest-cov>=2.5
16+
- pytest>=3.0
17+
- python-graphviz
18+
- python=3.6
19+
- recommonmark>=0.4
20+
- sphinx-autobuild>=0.7
21+
- sphinx>=1.5
22+
- watermark

conda-envs/environment-dev-py37.yml

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,20 @@
11
name: pymc3-dev-py37
22
channels:
3-
- conda-forge
4-
- defaults
3+
- conda-forge
4+
- defaults
55
dependencies:
6-
- python=3.7
7-
- arviz>=0.9
8-
- theano-pymc==1.0.11
9-
- numpy>=1.13
10-
- scipy>=0.18
11-
- pandas>=0.18
12-
- patsy>=0.5
13-
- fastprogress>=0.2
14-
- h5py>=2.7
15-
- typing-extensions>=3.7
16-
- python-graphviz
17-
- ipython>=7.16
18-
- nbsphinx>=0.4
19-
- numpydoc>=0.9
20-
- pre-commit>=2.8.0
21-
- pytest-cov>=2.5
22-
- pytest>=3.0
23-
- recommonmark>=0.4
24-
- sphinx-autobuild>=0.7
25-
- sphinx>=1.5
26-
- watermark
27-
- mkl-service
28-
- dill
29-
- libblas=*=*mkl
6+
- h5py>=2.7
7+
- ipython>=7.16
8+
- libblas=*=*mkl
9+
- mkl-service
10+
- nbsphinx>=0.4
11+
- numpydoc>=0.9
12+
- pre-commit>=2.8.0
13+
- pytest-cov>=2.5
14+
- pytest>=3.0
15+
- python-graphviz
16+
- python=3.7
17+
- recommonmark>=0.4
18+
- sphinx-autobuild>=0.7
19+
- sphinx>=1.5
20+
- watermark

conda-envs/environment-dev-py38.yml

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,20 @@
11
name: pymc3-dev-py38
22
channels:
3-
- conda-forge
4-
- defaults
3+
- conda-forge
4+
- defaults
55
dependencies:
6-
- python=3.8
7-
- arviz>=0.9
8-
- theano-pymc==1.0.11
9-
- numpy>=1.13
10-
- scipy>=0.18
11-
- pandas>=0.18
12-
- patsy>=0.5
13-
- fastprogress>=0.2
14-
- h5py>=2.7
15-
- typing-extensions>=3.7
16-
- python-graphviz
17-
- ipython>=7.16
18-
- nbsphinx>=0.4
19-
- numpydoc>=0.9
20-
- pre-commit>=2.8.0
21-
- pytest-cov>=2.5
22-
- pytest>=3.0
23-
- recommonmark>=0.4
24-
- sphinx-autobuild>=0.7
25-
- sphinx>=1.5
26-
- watermark
27-
- mkl-service
28-
- dill
29-
- libblas=*=*mkl
6+
- h5py>=2.7
7+
- ipython>=7.16
8+
- libblas=*=*mkl
9+
- mkl-service
10+
- nbsphinx>=0.4
11+
- numpydoc>=0.9
12+
- pre-commit>=2.8.0
13+
- pytest-cov>=2.5
14+
- pytest>=3.0
15+
- python-graphviz
16+
- python=3.8
17+
- recommonmark>=0.4
18+
- sphinx-autobuild>=0.7
19+
- sphinx>=1.5
20+
- watermark

pymc3/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ def __set_compiler_flags():
3232
# Workarounds for Theano compiler problems on various platforms
3333
import theano
3434

35-
current = theano.config.gcc.cxxflags
36-
theano.config.gcc.cxxflags = f"{current} -Wno-c++11-narrowing"
35+
current = theano.config.gcc__cxxflags
36+
theano.config.gcc__cxxflags = f"{current} -Wno-c++11-narrowing"
3737

3838

3939
__set_compiler_flags()

pymc3/distributions/distribution.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,7 @@ def draw_values(params, point=None, size=None):
690690
"""
691691
# The following check intercepts and redirects calls to
692692
# draw_values in the context of sample_posterior_predictive
693+
size = to_tuple(size)
693694
ppc_sampler = vectorized_ppc.get(None)
694695
if ppc_sampler is not None:
695696
# this is being done inside new, vectorized sample_posterior_predictive

pymc3/distributions/multivariate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ def perform(self, node, inputs, outputs):
724724
pm._log.exception("Failed to check if %s positive definite", x)
725725
raise
726726

727-
def infer_shape(self, node, shapes):
727+
def infer_shape(self, fgraph, node, shapes):
728728
return [[]]
729729

730730
def grad(self, inp, grads):

pymc3/distributions/simulator.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
from scipy.spatial import cKDTree
2020

21-
from pymc3.distributions.distribution import NoDistribution, draw_values
21+
from pymc3.distributions.distribution import NoDistribution, draw_values, to_tuple
2222

2323
__all__ = ["Simulator"]
2424

@@ -114,11 +114,12 @@ def random(self, point=None, size=None):
114114
-------
115115
array
116116
"""
117+
size = to_tuple(size)
117118
params = draw_values([*self.params], point=point, size=size)
118-
if size is None:
119+
if len(size) == 0:
119120
return self.function(*params)
120121
else:
121-
return np.array([self.function(*params) for _ in range(size)])
122+
return np.array([self.function(*params) for _ in range(size[0])])
122123

123124
def _str_repr(self, name=None, dist=None, formatting="plain"):
124125
if dist is None:

pymc3/math.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ def grad(self, inputs, gout):
363363
idx = tt.arange(gz.shape[-1])
364364
return [gz[..., idx, idx]]
365365

366-
def infer_shape(self, nodes, shapes):
366+
def infer_shape(self, fgraph, nodes, shapes):
367367
return [(shapes[0][0],) + (shapes[0][1],) * 2]
368368

369369

@@ -422,7 +422,7 @@ def grad(self, inputs, gout):
422422
]
423423
return [gout[0][slc] for slc in slices]
424424

425-
def infer_shape(self, nodes, shapes):
425+
def infer_shape(self, fgraph, nodes, shapes):
426426
first, second = zip(*shapes)
427427
return [(tt.add(*first), tt.add(*second))]
428428

0 commit comments

Comments
 (0)