Skip to content

Commit

Permalink
Update distributions.py
Browse files Browse the repository at this point in the history
  • Loading branch information
galenseilis authored Jun 14, 2024
1 parent 8c6bb9a commit 2ede7bd
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions ciw/dists/distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def sample(self, t=None, ind=None):

class Uniform(Distribution):
"""
The Uniform distribution.
The continuous uniform distribution over an interval.
Takes:
- `lower` the lower bound
Expand Down Expand Up @@ -114,14 +114,22 @@ class Deterministic(Distribution):
"""
The Deterministic distribution.
Takes:
- `value` the value to return
Notes
-----
This class samples from a degenerate distribution for a non-negative constant random variable.
This distribution is closely-related to the Dirac δ distribution.
"""

def __init__(self, value):
"""
Parameters
----------
value
The value that is sampled.
"""
if value < 0.0:
raise ValueError(
"Deterministic distribution must sample positive numbers only."
"Deterministic distribution must sample non-negative numbers only."
)
self.value = value

Expand Down

0 comments on commit 2ede7bd

Please sign in to comment.