probly.utils.probabilities

General utility functions for all other modules.

Functions

differential_entropy_gaussian(sigma2[, base])

Compute the differential entropy of a Gaussian distribution given the variance.

intersection_probability(probs)

Compute the intersection probability of a credal set based on intervals of lower and upper probabilities.

kl_divergence_gaussian(mu1, sigma21, mu2, ...)

Compute the KL-divergence between two Gaussian distributions.

probly.utils.probabilities.differential_entropy_gaussian(sigma2, base=2)[source]

Compute the differential entropy of a Gaussian distribution given the variance.

Parameters:
  • sigma2 (float | ndarray) – float or numpy.ndarray shape (n_instances,), variance of the Gaussian distribution

  • base (float) – float, base of the logarithm

Returns:

float or numpy.ndarray shape (n_instances,), differential entropy of the Gaussian distribution

Return type:

diff_ent

probly.utils.probabilities.intersection_probability(probs)[source]

Compute the intersection probability of a credal set based on intervals of lower and upper probabilities.

Computes the intersection probability from [Cuz22].

Parameters:

probs (ndarray) – numpy.ndarray, shape (n_instances, n_samples, n_classes), credal sets

Returns:

numpy.ndarray, shape (n_instances, n_classes), intersection probability of the credal sets

Return type:

int_probs

probly.utils.probabilities.kl_divergence_gaussian(mu1, sigma21, mu2, sigma22, base=2)[source]

Compute the KL-divergence between two Gaussian distributions.

Parameters:
  • mu1 (float | ndarray) – float or numpy.ndarray shape (n_instances,), mean of the first Gaussian distribution

  • sigma21 (float | ndarray) – float or numpy.ndarray shape (n_instances,), variance of the first Gaussian distribution

  • mu2 (float | ndarray) – float or numpy.ndarray shape (n_instances,), mean of the second Gaussian distribution

  • sigma22 (float | ndarray) – float or numpy.ndarray shape (n_instances,), variance of the second Gaussian distribution

  • base (float) – float, base of the logarithm

Returns:

float or numpy.ndarray shape (n_instances,), KL-divergence between the two Gaussian distributions

Return type:

kl_div