distribution
Distribution
Abstract base class for a distribution.
Source code in hfppl/distributions/distribution.py
argmax(n)
async
Return the nth most probable outcome under this distribution (assuming this is a discrete distribution).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n
|
int
|
which value to return to, indexed from most probable (n=0) to least probable (n=|support|). |
required |
Returns: x: the nth most probable outcome from this distribution.
Source code in hfppl/distributions/distribution.py
log_prob(x)
async
Compute the log probability of a value under this distribution, or the log probability density if the distribution is continuous.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
the point at which to evaluate the log probability. |
required |
Returns:
logprob (float): the log probability of x
.
Source code in hfppl/distributions/distribution.py
sample()
async
Generate a random sample from the distribution.
Returns:
Name | Type | Description |
---|---|---|
x |
a value randomly sampled from the distribution. |