-
Notifications
You must be signed in to change notification settings - Fork 2.2k
premshaw04/#7581/Fix Censored doc type hints and add example for partially censored array inputs #7954
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
premshaw04/#7581/Fix Censored doc type hints and add example for partially censored array inputs #7954
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
| 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 | ||
|
|
@@ -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) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
|
||
There was a problem hiding this comment.
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, optionalThere was a problem hiding this comment.
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.