Skip to content

Commit 1a143b7

Browse files
committed
Fix interval transform examples
1 parent b4c7eb1 commit 1a143b7

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

pymc/distributions/transforms.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -241,34 +241,38 @@ class Interval(IntervalTransform):
241241
242242
Examples
243243
--------
244+
245+
Create an interval transform between -1 and +1
246+
244247
.. code-block:: python
245248
246-
# Create an interval transform between -1 and +1
247249
with pm.Model():
248250
interval = pm.distributions.transforms.Interval(lower=-1, upper=1)
249251
x = pm.Normal("x", transform=interval)
250252
253+
Create a lower-bounded interval transform at 0, using a callable
254+
251255
.. code-block:: python
252256
253-
# Create an interval transform between -1 and +1 using a callable
254-
def get_bounds(rng, size, dtype, loc, scale):
257+
def get_bounds(rng, size, dtype, mu, sigma):
255258
return 0, None
256259
257260
with pm.Model():
258261
interval = pm.distributions.transforms.Interval(bouns_fn=get_bounds)
259262
x = pm.Normal("x", transform=interval)
260263
264+
Create a lower-bounded interval transform that depends on a distribution parameter
265+
261266
.. code-block:: python
262267
263-
# Create a lower bounded interval transform based on a distribution parameter
264-
def get_bounds(rng, size, dtype, loc, scale):
265-
return loc, None
268+
def get_bounds(rng, size, dtype, mu, sigma):
269+
return mu - 1, None
266270
267271
interval = pm.distributions.transforms.Interval(bounds_fn=get_bounds)
268272
269273
with pm.Model():
270-
loc = pm.Normal("loc")
271-
x = pm.Normal("x", mu=loc, sigma=2, transform=interval)
274+
mu = pm.Normal("mu")
275+
x = pm.Normal("x", mu=mu, sigma=2, transform=interval)
272276
"""
273277

274278
def __init__(self, lower=None, upper=None, *, bounds_fn=None):

0 commit comments

Comments
 (0)