probabilistic_model.learning.jpt.variables#

Classes#

Integer

Class for ordered, discrete random variables.

Continuous

Base class for continuous variables in JPTs. This class does not standardize the data,

ScaledContinuous

A continuous variable that is standardized.

Functions#

infer_variables_from_dataframe(...)

Infer the variables from a dataframe.

Module Contents#

probabilistic_model.learning.jpt.variables.infer_variables_from_dataframe(data: pandas.DataFrame, scale_continuous_types: bool = False, min_likelihood_improvement: float = 0.1, min_samples_per_quantile: int = 10) typing_extensions.List[random_events.variable.Variable]#

Infer the variables from a dataframe. The variables are inferred by the column names and types of the dataframe.

Parameters:
  • data – The dataframe to infer the variables from.

  • scale_continuous_types – Whether to scale numeric types.

  • min_likelihood_improvement – The minimum likelihood improvement passed to the Continuous Variables.

  • min_samples_per_quantile – The minimum number of samples per quantile passed to the Continuous Variables.

Returns:

The inferred variables.

class probabilistic_model.learning.jpt.variables.Integer(name: str, mean, std)#

Bases: random_events.variable.Integer

Class for ordered, discrete random variables.

The domain of an integer variable is the number line.

mean: float#

Mean of the random variable.

std: float#

Standard Deviation of the random variable.

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

__eq__(other)#
__hash__()#
class probabilistic_model.learning.jpt.variables.Continuous(name: str, mean: float, std: float, minimal_distance: float = 1.0, min_likelihood_improvement: float = 0.1, min_samples_per_quantile: int = 10)#

Bases: random_events.variable.Continuous

Base class for continuous variables in JPTs. This class does not standardize the data, but needs to know mean and std anyway.

mean: float#

Mean of the random variable.

std: float#

Standard Deviation of the random variable.

minimal_distance: float#

The minimal distance between two values of the variable.

min_likelihood_improvement: float#

The minimum likelihood improvement passed to the Nyga Distributions.

min_samples_per_quantile: int#

The minimum number of samples per quantile passed to the Nyga Distributions.

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

class probabilistic_model.learning.jpt.variables.ScaledContinuous(name: str, mean: float, std: float, minimal_distance: float = 1.0, min_likelihood_improvement: float = 0.1, min_samples_per_quantile: int = 10)#

Bases: Continuous

A continuous variable that is standardized.

encode(value: typing_extensions.Any)#
decode(value: float) float#
__str__()#