probabilistic_model.utils#

Classes#

MissingDict

A defaultdict that returns the default value when the key is missing and does not add the key to the dict.

Functions#

simple_interval_as_array(→ numpy.ndarray)

Convert a simple interval to a numpy array.

interval_as_array(→ numpy.ndarray)

Convert an interval to a numpy array.

timeit(func)

Decorator to measure the time a function takes to execute.

timeit_print(func)

neighbouring_points(→ numpy.array)

Embed the point in an array with the next left and next right point.

Module Contents#

probabilistic_model.utils.simple_interval_as_array(interval: random_events.interval.SimpleInterval) numpy.ndarray#

Convert a simple interval to a numpy array. :param interval: The interval :return: [lower, upper] as numpy array

probabilistic_model.utils.interval_as_array(interval: random_events.interval.Interval) numpy.ndarray#

Convert an interval to a numpy array. The resulting array has shape (n, 2) where n is the number of simple intervals in the interval. The first column contains the lower bounds and the second column the upper bounds of the simple intervals. :param interval: The interval :return: as numpy array

class probabilistic_model.utils.MissingDict#

Bases: collections.defaultdict

A defaultdict that returns the default value when the key is missing and does not add the key to the dict.

__missing__(key)#
probabilistic_model.utils.timeit(func)#

Decorator to measure the time a function takes to execute.

probabilistic_model.utils.timeit_print(func)#
probabilistic_model.utils.neighbouring_points(point: float) numpy.array#

Embed the point in an array with the next left and next right point.

Parameters:

point – The point.

Returns:

The point and its two neighbours