Skip to content

Commit 63f6be5

Browse files
Merge branch 'pymc-devs:main' into model_builder_adaptations
2 parents 51cb782 + 5259105 commit 63f6be5

File tree

8 files changed

+17
-25
lines changed

8 files changed

+17
-25
lines changed

.github/workflows/test.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,20 @@ jobs:
5858
miniforge-variant: Mambaforge
5959
miniforge-version: latest
6060
mamba-version: "*"
61-
activate-environment: pymc-test
61+
activate-environment: pymc-experimental-test
6262
channel-priority: strict
6363
environment-file: conda-envs/environment-test.yml
6464
python-version: ${{matrix.python-version}}
6565
use-mamba: true
6666
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
67-
- name: Install-pymc
67+
- name: Install pymc-experimental
6868
run: |
69-
conda activate pymc-test
69+
conda activate pymc-experimental-test
7070
pip install -e .
7171
python --version
7272
- name: Run tests
7373
run: |
74-
conda activate pymc-test
74+
conda activate pymc-experimental-test
7575
python -m pytest -vv --cov=pymc_experimental --cov-append --cov-report=xml --cov-report term --durations=50 $TEST_SUBSET
7676
- name: Upload coverage to Codecov
7777
uses: codecov/codecov-action@v2
@@ -123,22 +123,22 @@ jobs:
123123
miniforge-variant: Mambaforge
124124
miniforge-version: latest
125125
mamba-version: "*"
126-
activate-environment: pymc-test
126+
activate-environment: pymc-experimental-test
127127
channel-priority: strict
128128
environment-file: conda-envs/windows-environment-test.yml
129129
python-version: ${{matrix.python-version}}
130130
use-mamba: true
131131
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
132-
- name: Install-pymc
132+
- name: Install pymc-experimental
133133
run: |
134-
conda activate pymc-test
134+
conda activate pymc-experimental-test
135135
pip install -e .
136136
python --version
137137
- name: Run tests
138138
# This job uses a cmd shell, therefore the environment variable syntax is different!
139139
# The ">-" in the next line replaces newlines with spaces (see https://stackoverflow.com/a/66809682).
140140
run: >-
141-
conda activate pymc-test &&
141+
conda activate pymc-experimental-test &&
142142
python -m pytest -vv --cov=pymc_experimental --cov-append --cov-report=xml --cov-report term --durations=50 %TEST_SUBSET%
143143
- name: Upload coverage to Codecov
144144
uses: codecov/codecov-action@v2

conda-envs/environment-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: pymc-test
1+
name: pymc-experimental-test
22
channels:
33
- conda-forge
44
- defaults
@@ -9,5 +9,5 @@ dependencies:
99
- dask
1010
- xhistogram
1111
- pip:
12-
- "git+https://github.com/pymc-devs/pymc.git@main"
12+
- pymc>=5.1.2 # CI was failing to resolve
1313
- blackjax

conda-envs/windows-environment-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: pymc-test
1+
name: pymc-experimental-test
22
channels:
33
- conda-forge
44
- defaults
@@ -9,4 +9,4 @@ dependencies:
99
- dask
1010
- xhistogram
1111
- pip:
12-
- "git+https://github.com/pymc-devs/pymc.git@main"
12+
- pymc>=5.1.2 # CI was failing to resolve

pymc_experimental/marginal_model.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ def _delete_rv_mappings(self, rv: TensorVariable) -> None:
9393
self.rvs_to_initial_values.pop(rv)
9494
else:
9595
self.observed_RVs.remove(rv)
96-
if rv in self.rvs_to_total_sizes:
97-
self.rvs_to_total_sizes.pop(rv)
9896

9997
def _transfer_rv_mappings(self, old_rv: TensorVariable, new_rv: TensorVariable) -> None:
10098
"""Transfer model mappings from old_rv to new_rv"""
@@ -122,8 +120,6 @@ def _transfer_rv_mappings(self, old_rv: TensorVariable, new_rv: TensorVariable)
122120
index = self.observed_RVs.index(old_rv)
123121
self.observed_RVs.pop(index)
124122
self.observed_RVs.insert(index, new_rv)
125-
if old_rv in self.rvs_to_total_sizes:
126-
self.rvs_to_total_sizes[new_rv] = self.rvs_to_total_sizes.pop(old_rv)
127123

128124
def _marginalize(self, user_warnings=False):
129125
fg = FunctionGraph(outputs=self.basic_RVs + self.marginalized_rvs, clone=False)
@@ -212,10 +208,6 @@ def clone(self):
212208
m.values_to_rvs = {i: vars_to_clone[rv] for i, rv in self.values_to_rvs.items()}
213209
m.rvs_to_values = {vars_to_clone[rv]: i for rv, i in self.rvs_to_values.items()}
214210
m.rvs_to_transforms = {vars_to_clone[rv]: i for rv, i in self.rvs_to_transforms.items()}
215-
# Special logic due to bug in pm.Model
216-
m.rvs_to_total_sizes = {
217-
vars_to_clone[rv]: i for rv, i in self.rvs_to_total_sizes.items() if rv in vars_to_clone
218-
}
219211
m.rvs_to_initial_values = {
220212
vars_to_clone[rv]: i for rv, i in self.rvs_to_initial_values.items()
221213
}

pymc_experimental/tests/distributions/test_continuous.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import scipy.stats.distributions as sp
2222

2323
# test support imports from pymc
24-
from pymc.tests.distributions.util import (
24+
from pymc.testing import (
2525
BaseTestDistributionRandom,
2626
Domain,
2727
R,
@@ -30,8 +30,8 @@
3030
check_logcdf,
3131
check_logp,
3232
seeded_scipy_distribution_builder,
33+
select_by_precision,
3334
)
34-
from pymc.tests.helpers import select_by_precision
3535

3636
# the distributions to be tested
3737
from pymc_experimental.distributions import GenExtreme

pymc_experimental/tests/test_marginal_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def test_nested_marginalized_rvs():
170170
sigma = pm.HalfNormal("sigma")
171171

172172
idx = pm.Bernoulli("idx", p=0.75)
173-
dep = pm.Normal("dep", mu=pt.switch(pt.eq(idx, 0), -1000, 1000), sigma=sigma)
173+
dep = pm.Normal("dep", mu=pt.switch(pt.eq(idx, 0), -1000.0, 1000.0), sigma=sigma)
174174

175175
sub_idx = pm.Bernoulli("sub_idx", p=pt.switch(pt.eq(idx, 0), 0.15, 0.95), shape=(5,))
176176
sub_dep = pm.Normal("sub_dep", mu=dep + sub_idx * 100, sigma=sigma, shape=(5,))

pymc_experimental/tests/test_model_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def test_predict():
132132
assert "y_model" in pred
133133
assert isinstance(pred, dict)
134134
assert len(prediction_data.input.values) == len(pred["y_model"])
135-
assert isinstance(pred["y_model"][0], float)
135+
assert isinstance(pred["y_model"][0], (np.float32, np.float64))
136136

137137

138138
def test_predict_posterior():

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pymc>=5.0.0
1+
pymc>=5.1.2

0 commit comments

Comments
 (0)