Skip to content

Basic Usage

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

Basic Usage

Welcome to the entropic_measurement package! This page introduces the main functionality with clear examples to help new users get started.

Overview

The entropic_measurement library provides tools for calculating entropy measures for data analysis and scientific research. It supports workflows for both simple and advanced entropy computations.

Installation

pip install entropic_measurement

Example Workflow

Below is a basic example of how to use the library for Shannon entropy calculation:

from entropic_measurement import ShannonEntropy

data = [0.2, 0.5, 0.3]
shannon = ShannonEntropy()
result = shannon.compute(data)
print(f"Shannon Entropy: {result}")

Main Classes

  • ShannonEntropy: Computes classic Shannon entropy for a probability distribution.
  • RenyiEntropy: For Renyi entropy, parameterized by the order alpha.
  • TsallisEntropy: For Tsallis entropy, also with an adjustable parameter q.

Additional Examples

Renyi Entropy Example

from entropic_measurement import RenyiEntropy

data = [0.1, 0.4, 0.5]
renyi = RenyiEntropy(alpha=2)
result = renyi.compute(data)
print(f"Renyi Entropy (alpha=2): {result}")

Tsallis Entropy Example

from entropic_measurement import TsallisEntropy

tsallis = TsallisEntropy(q=1.5)
data = [0.25, 0.25, 0.25, 0.25]
result = tsallis.compute(data)
print(f"Tsallis Entropy (q=1.5): {result}")

Notes

  • Input data should be valid probability distributions (sum to 1).
  • Explore the API for more features like vectorized operations and custom distributions.

Further Reading

See also the API Reference for class details and advanced usage tips.

Clone this wiki locally