probabilistic_model.distributions.uniform#
Classes#
Class for uniform distributions over the half-open interval [lower, upper). |
Module Contents#
- class probabilistic_model.distributions.uniform.UniformDistribution(variable: probabilistic_model.distributions.distributions.Continuous, interval: probabilistic_model.distributions.distributions.SimpleInterval)#
Bases:
probabilistic_model.distributions.distributions.ContinuousDistributionWithFiniteSupportClass for uniform distributions over the half-open interval [lower, upper).
- variable#
- interval#
The interval of the distribution.
- log_likelihood_without_bounds_check(x: probabilistic_model.distributions.distributions.np.array) probabilistic_model.distributions.distributions.np.array#
Evaluate the logarithmic likelihood function at x without checking the inclusion into the interval. :param x: x where p(x) > 0 :return: log(p(x))
- cdf(x: probabilistic_model.distributions.distributions.np.array) probabilistic_model.distributions.distributions.np.array#
Calculate the cumulative distribution function at x. :param x: The data :return: The cumulative distribution function at x
- univariate_log_mode() probabilistic_model.distributions.distributions.Tuple[probabilistic_model.distributions.distributions.AbstractCompositeSet, float]#
- Returns:
The univariate mode of the distribution and its log-likelihood. The mode is not an Event.
- log_conditional_from_simple_interval(interval: probabilistic_model.distributions.distributions.SimpleInterval) probabilistic_model.distributions.distributions.Tuple[probabilistic_model.distributions.distributions.Self, float]#
Calculate the truncated distribution given a simple interval.
- Parameters:
interval – The simple interval
- Returns:
The truncated distribution and the log-probability of the interval.
- sample(amount: int) probabilistic_model.distributions.distributions.np.array#
Sample from the model.
- Parameters:
amount – The number of samples to draw.
- Returns:
The samples.
- pdf_value() float#
Calculate the density of the uniform distribution.
- log_pdf_value() float#
Calculate the log-density of the uniform distribution.
- moment(order: probabilistic_model.distributions.distributions.OrderType, center: probabilistic_model.distributions.distributions.CenterType) probabilistic_model.distributions.distributions.MomentType#
Calculate the (centralized) moment of the distribution.
\[\int_{-\infty}^{\infty} (x - center)^{order} pdf(x) dx\]Note
You can read more about queries of this class in Definition 22 in :cite:p:`choi2020probabilistic`_. [US20]
- Parameters:
order – The orders of the moment as a variable map for every continuous and integer variable.
center – The center of the moment as a variable map for every continuous and integer variable.
- Returns:
The moments of the variables in order.
- __eq__(other)#
- property drawio_label#
The label of the object as a drawio compatible string.
- property representation#
The symbol used to represent this distribution.
- property abbreviated_symbol: str#
- __repr__()#
- property image#
- __copy__()#
- __deepcopy__(memo=None)#
- to_json() probabilistic_model.distributions.distributions.Dict[str, probabilistic_model.distributions.distributions.Any]#
- classmethod _from_json(data: probabilistic_model.distributions.distributions.Dict[str, probabilistic_model.distributions.distributions.Any]) probabilistic_model.distributions.distributions.Self#
Create a variable from a json dict. This method is called from the from_json method after the correct subclass is determined and should be overwritten by the respective subclass.
- Parameters:
data – The json dict
- Returns:
The deserialized object
- x_axis_points_for_plotly() probabilistic_model.distributions.distributions.List[probabilistic_model.distributions.distributions.Union[None, float]]#
- pdf_trace() probabilistic_model.distributions.distributions.go.Scatter#
- cdf_trace() probabilistic_model.distributions.distributions.go.Scatter#
- plot(**kwargs) probabilistic_model.distributions.distributions.List#
Generate traces that can be plotted with plotly.
- Parameters:
number_of_samples – The number of samples to draw.
surface – If True, plot the model as a surface plot.
mode – If True, plot the mode of the model.
- Returns:
The traces.
- __hash__()#