Skip to content

API Reference

Raphael Constantinis edited this page Jul 23, 2025 · 1 revision

API Reference

This page lists the main public classes, functions, and key parameters in the entropic_measurement library. For each function/class, default values and code examples are provided when available.

Entropy Measures

shannon_entropy(data, base=2, correction=None, smoothing=None, alpha=None)

  • Description: Computes the Shannon entropy of a discrete probability distribution.
  • Parameters:
    • data (array-like): input probability distribution
    • base (int or str, default=2): log base ("e" for nats, 10 for dits)
    • correction (str or callable, optional): bias correction method
    • smoothing (str, optional): smoothing method ("laplace", "lidstone")
    • alpha (float, optional): parameter for smoothing
  • Returns: float
import entropic_measurement as em
entropy = em.shannon_entropy([0.5, 0.5])  # Returns 1.0

renyi_entropy(data, alpha=2, base=2)

  • Description: Computes the Rényi entropy for a given order α.
  • Parameters: same as above, plus alpha (order)
  • Returns: float

tsallis_entropy(data, q=2, base=2)

  • Description: Computes Tsallis entropy of order q.
  • Parameters: same as above, plus q
  • Returns: float

Information Measures

conditional_entropy(y, x, bins=None)

  • Description: Calculates H(Y|X) — conditional entropy of Y given X.

mutual_information(x, y, bins=None)

  • Description: Computes information shared between X and Y.

kl_divergence(p, q, base=2)

  • Description: Kullback-Leibler divergence D_KL(P||Q).

Other Utilities

  • EntropyProfile(data) — Convenience class for multi-measure analysis
  • multidimensional_entropy(data2d, method='joint') — Joint/Marginal entropy

Typical Return Types

  • Float for most entropy/information functions
  • Dict for profile classes/results
  • Numpy arrays for vectorized calculations

Further Reference

  • For all parameters, see function docstrings (use Python's help()).
  • Visit the Examples page for usage in workflows.

Clone this wiki locally