random_events.variable#

Classes#

Variable

Parent class for all random variables.

Continuous

Class for continuous random variables.

Symbolic

Class for unordered, finite, discrete random variables.

Integer

Class for ordered, discrete random variables.

Module Contents#

class random_events.variable.Variable(name: str, domain: random_events.sigma_algebra.AbstractCompositeSet)#

Bases: random_events.utils.SubclassJSONSerializer, random_events.utils.CPPWrapper

Parent class for all random variables.

name: str#

The name of the variable.

domain: random_events.sigma_algebra.AbstractCompositeSet#

The domain of the variable.

__lt__(other: typing_extensions.Self) bool#
__hash__() int#
__eq__(other)#
__str__()#
__repr__()#
to_json() typing_extensions.Dict[str, typing_extensions.Any]#
classmethod _from_json(data: typing_extensions.Dict[str, typing_extensions.Any]) typing_extensions.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

abstract property is_numeric#
Returns:

Rather, this variable has a numeric domain or not.

classmethod _from_cpp(cpp_object)#
Abstractmethod:

Create a variable from a C++ object.

abstract make_value(value: typing_extensions.Any) random_events.sigma_algebra.AbstractCompositeSet#

Create a value of the domain from an arbitrary value. This method tries to parse the value and wrap it in a composite set.

Parameters:

value – The value.

Returns:

The value wrapped in a composite set.

class random_events.variable.Continuous(name: str, *args, **kwargs)#

Bases: Variable

Class for continuous random variables.

The domain of a continuous variable is the real line.

_cpp_object#

The C++ object that this class wraps.

property is_numeric#
Returns:

Rather, this variable has a numeric domain or not.

_from_cpp(cpp_object)#

Create a variable from a C++ object.

make_value(value: typing_extensions.Any) random_events.interval.Interval#

Create a value of the domain from an arbitrary value. This method tries to parse the value and wrap it in a composite set.

Parameters:

value – The value.

Returns:

The value wrapped in a composite set.

class random_events.variable.Symbolic(name: typing_extensions.Optional[str], domain: random_events.set.Set)#

Bases: Variable

Class for unordered, finite, discrete random variables.

The domain of a symbolic variable is a set.

domain: random_events.set.Set#

The domain of the variable.

_cpp_object#

The C++ object that this class wraps.

property is_numeric#
Returns:

Rather, this variable has a numeric domain or not.

_from_cpp(cpp_object)#

Create a variable from a C++ object.

make_value(value) random_events.set.Set#

Create a value of the domain from an arbitrary value. This method tries to parse the value and wrap it in a composite set.

Parameters:

value – The value.

Returns:

The value wrapped in a composite set.

class random_events.variable.Integer(name: str, domain: random_events.sigma_algebra.AbstractCompositeSet = reals())#

Bases: Variable

Class for ordered, discrete random variables.

The domain of an integer variable is the number line.

_cpp_object#

The C++ object that this class wraps.

property is_numeric#
Returns:

Rather, this variable has a numeric domain or not.

_from_cpp(cpp_object)#

Create a variable from a C++ object.

make_value(value: typing_extensions.Any) random_events.interval.Interval#

Create a value of the domain from an arbitrary value. This method tries to parse the value and wrap it in a composite set.

Parameters:

value – The value.

Returns:

The value wrapped in a composite set.