Skip to content

Implement Truncated distributions #6113

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

Merged
merged 3 commits into from
Sep 14, 2022
Merged
Show file tree
Hide file tree
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
9 changes: 5 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,21 @@ jobs:

- |
pymc/tests/distributions/test_distribution.py
pymc/tests/distributions/test_bound.py
pymc/tests/distributions/test_censored.py
pymc/tests/distributions/test_discrete.py
pymc/tests/distributions/test_continuous.py
pymc/tests/distributions/test_multivariate.py

- |
pymc/tests/distributions/test_bound.py
pymc/tests/distributions/test_censored.py
pymc/tests/distributions/test_simulator.py
pymc/tests/distributions/test_truncated.py

- |
pymc/tests/tuning/test_scaling.py
pymc/tests/tuning/test_starting.py
pymc/tests/test_shared.py
pymc/tests/test_types.py

- |
pymc/tests/distributions/test_dist_math.py
pymc/tests/distributions/test_transform.py
pymc/tests/test_parallel_sampling.py
Expand Down
2 changes: 2 additions & 0 deletions pymc/distributions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
MvStudentTRandomWalk,
RandomWalk,
)
from pymc.distributions.truncated import Truncated

__all__ = [
"Uniform",
Expand Down Expand Up @@ -192,6 +193,7 @@
"Rice",
"Moyal",
"Simulator",
"Truncated",
"Censored",
"CAR",
"PolyaGamma",
Expand Down
9 changes: 9 additions & 0 deletions pymc/distributions/bound.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import warnings

import aesara.tensor as at
import numpy as np
Expand Down Expand Up @@ -182,6 +183,14 @@ def __new__(
**kwargs,
):

warnings.warn(
"Bound has been deprecated in favor of Truncated, and will be removed in a "
"future release. If Truncated is not an option, Bound can be implemented by"
"adding an IntervalTransform between lower and upper to a continuous "
"variable. A Potential that returns negative infinity for values outside "
"of the bounds can be used for discrete variables.",
FutureWarning,
)
cls._argument_checks(dist, **kwargs)

if dims is not None:
Expand Down
Loading