|
13 | 13 | # limitations under the License.
|
14 | 14 |
|
15 | 15 | import numpy as np
|
| 16 | +import pytest |
16 | 17 | import theano.tensor as tt
|
17 | 18 |
|
18 | 19 | import pymc3 as pm
|
@@ -189,3 +190,23 @@ def test_repr_latex(self):
|
189 | 190 | assert expected == self.s._repr_latex_()
|
190 | 191 | assert self.s._repr_latex_() == self.s.__latex__()
|
191 | 192 | assert self.SMABC_test.model._repr_latex_() == self.SMABC_test.model.__latex__()
|
| 193 | + |
| 194 | + def test_name_is_string_type(self): |
| 195 | + with self.SMABC_potential: |
| 196 | + assert not self.SMABC_potential.name |
| 197 | + trace = pm.sample_smc(draws=10, kernel="ABC") |
| 198 | + assert isinstance(trace._straces[0].name, str) |
| 199 | + |
| 200 | + def test_named_models_are_unsupported(self): |
| 201 | + def normal_sim(a, b): |
| 202 | + return np.random.normal(a, b, 1000) |
| 203 | + |
| 204 | + with pm.Model(name="NamedModel"): |
| 205 | + a = pm.Normal("a", mu=0, sigma=1) |
| 206 | + b = pm.HalfNormal("b", sigma=1) |
| 207 | + c = pm.Potential("c", pm.math.switch(a > 0, 0, -np.inf)) |
| 208 | + s = pm.Simulator( |
| 209 | + "s", normal_sim, params=(a, b), sum_stat="sort", epsilon=1, observed=self.data |
| 210 | + ) |
| 211 | + with pytest.raises(NotImplementedError, match="named models"): |
| 212 | + pm.sample_smc(draws=10, kernel="ABC") |
0 commit comments