jpt.distributions.univariate.integer

© Copyright 2021, Mareike Picklum, Daniel Nyga.

Classes

IntegerMap

A mapping of external integers to their internal representation and vice versa.

IntegerLabelToValueMap

Maps integer labels to their internal values

IntegerValueToLabelMap

Maps internal integer values to integer labels.

Integer

Abstract supertype of all domains and distributions

Functions

IntegerType(→ Type[Integer])

Module Contents

class jpt.distributions.univariate.integer.IntegerMap(lmin: int | None = None, lmax: int | None = None)

Bases: jpt.distributions.univariate.distribution.ValueMap

A mapping of external integers to their internal representation and vice versa.

_min
_max
__eq__(other: IntegerMap) bool
__len__()
__hash__()
__contains__(item)
__iter__()
abstract as_set() jpt.base.intervals.IntSet
class jpt.distributions.univariate.integer.IntegerLabelToValueMap(lmin: int | None = None, lmax: int | None = None)

Bases: IntegerMap

Maps integer labels to their internal values

property min
property max
__getitem__(label: int) int
as_set() jpt.base.intervals.IntSet
class jpt.distributions.univariate.integer.IntegerValueToLabelMap(lmin: int | None = None, lmax: int | None = None)

Bases: IntegerMap

Maps internal integer values to integer labels.

property min
property max
__getitem__(value: int) int
as_set() jpt.base.intervals.IntSet
class jpt.distributions.univariate.integer.Integer(**settings)

Bases: jpt.distributions.univariate.Distribution

Abstract supertype of all domains and distributions

values: IntegerLabelToValueMap | None
labels
OPEN_DOMAIN = 'open_domain'
AUTO_DOMAIN = 'auto_domain'
SETTINGS
min() int | None
max() int | None
_min() int | None
_max() int | None
_params: Dict[int, float] | None = None
to_json: types.FunctionType
classmethod hash()
__add__(other: Integer) Integer
__neg__() Integer
property cdf: jpt.base.functions.PiecewiseFunction
add(other: Integer, name: str | None = None) Integer
classmethod equiv(other: Type[jpt.distributions.univariate.Distribution]) bool
classmethod type_to_json() Dict[str, Any]
inst_to_json() Dict[str, Any]
static type_from_json(data)
classmethod from_json(data: Dict[str, Any]) Integer
copy()
property probabilities: Dict[int, float]
n_values() int | None
classmethod value2label(value: int | Iterable[int] | jpt.base.intervals.IntSet | jpt.base.intervals.UnionSet) int | Iterable[int] | jpt.base.intervals.IntSet | jpt.base.intervals.UnionSet
classmethod label2value(label: int | Iterable[int] | jpt.base.intervals.IntSet | jpt.base.intervals.UnionSet) int | Iterable[int] | jpt.base.intervals.IntSet | jpt.base.intervals.UnionSet
_sample(n: int) Iterable[int]
_sample_one() int
sample(n: int) Iterable[int]
sample_one() int
property _pdf: types.FunctionType
property pdf: types.FunctionType
p(labels: int | Iterable[int]) float
_p(values: int | Iterable[int]) float
expectation() float
_expectation() float
variance() float
_variance() float
_k_mpe(k: int | None = None) Iterable[Tuple[jpt.base.intervals.NumberSet, float]]

Calculate the k most probable explanation states.

Parameters:

k – The number of solutions to generate

Returns:

An list containing a tuple containing the likelihood and state in descending order.

k_mpe(k: int = None) Iterable[Tuple[jpt.base.intervals.NumberSet, float]]
mpe()
_mpe()
mode()
_mode()
crop(restriction: jpt.base.intervals.NumberSet | int) Integer
_crop(restriction: jpt.base.intervals.NumberSet | int) Integer
static merge(distributions: Iterable[Integer], weights: Iterable[numbers.Real]) Integer
update(dist: Integer, weight: int) Integer
fit(data: numpy.ndarray, rows: numpy.ndarray = None, col: int = None) Integer
_fit(data: numpy.ndarray, rows: numpy.ndarray = None, col: int = None) Integer
_set(params: Dict[int, float] or Iterable[float]) Integer
set(params: Dict[int, float] or Iterable[float]) Integer
__eq__(other) bool
__str__()
__repr__()
infinite() bool
finite() bool
_sorted(exhaustive: bool = True, reverse: bool = False, max_items: int = None) Iterable[Tuple[int, float]]
sorted(exhaustive: bool = True, reverse: bool = False, max_items: int = None) Iterable[Tuple[int, float]]
_items(exhaustive: bool = False, max_items: int = None) Iterable[Tuple[int, float]]

Return a list of (probability, value) pairs representing this distribution.

items(exhaustive: bool = True, max_items: int = None) Iterable[Tuple[int, float]]

Return a list of (probability, label) pairs representing this distribution.

kl_divergence(other: Integer) float
number_of_parameters() int
moment(order: int = 1, center: float = 0) float

Calculate the central moment of the r-th order almost everywhere.

\[\int (x-c)^{r} p(x)\]
Parameters:
  • order – The order of the moment to calculate

  • center – The constant to subtract in the basis of the exponent

static wasserstein_distance(d1: Integer, d2: Integer) float
distance(other: Integer) float
static jaccard_similarity(d1: Integer, d2: Integer) float
similarity(other: Integer) float
plot(engine=None, **kwargs) Any

Plots the distribution using the given engine.

Parameters:
  • engine – Can be either one of ["plotly", "matplotlib"], or an instance of a rendering engine subclassing DistributionRendering.

  • kwargs – The keyword arguments to pass to the engine as defined in the .plot_integer() function of DistributionRendering or its respective subclass defined by engine.

Returns:

the figure object of the plotting engine

jpt.distributions.univariate.integer.IntegerType(name: str, lmin: int | None = None, lmax: int | None = None) Type[Integer]