Skip to content

Interfaces

This section lists the most important interfaces used in the package.

bmi.interface.IMutualInformationPointEstimator (Protocol)

Interface for the mutual information estimator returning point estimates. All estimators should be implementations of this interface.

estimate(self, x, y)

A point estimate of MI(X; Y) from an i.i.d. sample from the \(P(X, Y)\) distribution.

Parameters:

Name Type Description Default
x Union[numpy.__array_like._SupportsArray[numpy.dtype[Any]], numpy.__nested_sequence._NestedSequence[numpy.__array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy.__nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]]

shape (n_samples, dim_x)

required
y Union[numpy.__array_like._SupportsArray[numpy.dtype[Any]], numpy.__nested_sequence._NestedSequence[numpy.__array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy.__nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]]

shape (n_samples, dim_y)

required

Returns:

Type Description
float

mutual information estimate

estimate_with_info(self, x, y)

Allows for reporting additional information about the run.

parameters(self)

Returns the parameters of the estimator.

bmi.interface.ISampler (Protocol)

Interface for a distribution \(P(X, Y)\).

dim_total: int property readonly

Dimension of the space in which the (X, Y) variable is valued. Should be equal to the sum of dim_x and dim_y.

dim_x: int property readonly

Dimension of the space in which the X variable is valued.

dim_y: int property readonly

Dimension of the space in which the Y variable is valued.

mutual_information(self)

Mutual information MI(X; Y).

sample(self, n_points, rng)

Returns a sample from the joint distribution P(X, Y).

Parameters:

Name Type Description Default
n_points int

sample size

required
rng Union[int, Any]

pseudorandom number generator

required

Returns:

Type Description
tuple[numpy.ndarray, numpy.ndarray]

X samples, shape (n_points, dim_x) Y samples, shape (n_points, dim_y). Note that these samples are paired with X samples.