Skip to content
Open
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
11 changes: 9 additions & 2 deletions pymc/distributions/censored.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ class Censored(Distribution):

.. warning:: dist will be cloned, rendering it independent of the one passed as input.

lower : float or None
lower : float | int | array-like | None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use human readable hints in the docstrings. Should be something like tensor_like, optional

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ricardoV94 Thank you so much sir for your suggestion, i will fix it.

Lower (left) censoring point. If `None` the distribution will not be left censored
upper : float or None
upper : float | int | array-like | None
Upper (right) censoring point. If `None`, the distribution will not be right censored.

Warnings
Expand All @@ -109,6 +109,13 @@ class Censored(Distribution):
with pm.Model():
normal_dist = pm.Normal.dist(mu=0.0, sigma=1.0)
censored_normal = pm.Censored("censored_normal", normal_dist, lower=-1, upper=1)

Partially censored vector using +/- inf masking:

>>> y = np.array([3.2, 10.5, 1.1, 14.4])
>>> lower = np.array([-np.inf, 9.0, -np.inf, 12.0])
>>> upper = np.array([ 4.0, np.inf, 2.5, np.inf])
>>> Censored("y_obs", pm.Normal.dist(mu=5, sigma=3), lower=lower, upper=upper, observed=y)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't run because it's not in a model context. Also use same format as previous examples not with >>> for consistency

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ricardoV94 Thank you so much sir for your suggestion , i will fix it really quick.

"""

rv_type = CensoredRV
Expand Down