Skip to main content

Epsilon Machine Inference & Characterization - A framework for computational mechanics

Project description

emic

CI Docs Coverage License: MIT Python 3.11+

Epsilon Machine Inference & Characterization

A Python framework for constructing and analyzing epsilon-machines based on computational mechanics.

📚 Documentation | 🚀 Getting Started

What is an Epsilon-Machine?

An epsilon-machine (ε-machine) is the minimal, optimal predictor of a stochastic process. Introduced by James Crutchfield and collaborators, ε-machines capture the intrinsic computational structure hidden in sequential data.

Key concepts:

  • Causal states: Equivalence classes of histories that yield identical predictions
  • Statistical complexity (Cμ): The entropy of the causal state distribution — a measure of structural complexity
  • Entropy rate (hμ): The irreducible randomness in the process

ε-machines reveal the emic structure of a process — the computational organization that exists within the system itself, not imposed from outside.

Features

  • 🔮 Inference: Reconstruct ε-machines from observed sequences using the CSSR algorithm
  • 📊 Analysis: Compute complexity measures (Cμ, hμ, excess entropy)
  • 🎲 Sources: Built-in stochastic process generators (Golden Mean, Even Process, Biased Coin, Periodic)
  • 🔗 Pipeline: Composable >> operator for source → inference → analysis workflows
  • 📈 Visualization: State diagram rendering with Graphviz
  • 📝 LaTeX Export: Publication-ready tables and machine descriptions
  • 🧩 Extensible: Protocol-based architecture for custom algorithms and sources

Installation

pip install emic

Or install from source with uv:

git clone https://github.com/johnazariah/emic.git
cd emic
uv sync --dev

Quick Start

from emic.sources import GoldenMeanSource
from emic.inference import CSSR, CSSRConfig
from emic.analysis import analyze

# Generate data from the Golden Mean process (no consecutive 1s)
source = GoldenMeanSource(p=0.5, seed=42)

# Infer the epsilon-machine using CSSR
config = CSSRConfig(max_history=5, significance=0.001)
result = CSSR(config).infer(source.take(10_000))

# Analyze the inferred machine
summary = analyze(result.machine)
print(f"States: {len(result.machine.states)}")
print(f"Statistical Complexity: Cμ = {summary.statistical_complexity:.4f}")
print(f"Entropy Rate: hμ = {summary.entropy_rate:.4f}")

Pipeline Composition

Chain operations using the >> operator:

from emic.sources import GoldenMeanSource
from emic.inference import CSSR, CSSRConfig
from emic.analysis import Analyzer

# Compose a full pipeline
result = (
    GoldenMeanSource(p=0.5, seed=42)
    >> CSSR(CSSRConfig(max_history=5, significance=0.001))
    >> Analyzer()
)

print(result.summary)

Supported Processes

Process Description True States
Golden Mean No consecutive 1s allowed 2
Even Process Even number of 1s between 0s 2
Biased Coin i.i.d. Bernoulli process 1
Periodic Deterministic repeating pattern n (period length)

Project Status

Core implementation complete — The framework is functional with:

  • CSSR inference algorithm with post-merge state optimization
  • Full analysis suite (Cμ, hμ, excess entropy)
  • Synthetic and empirical data sources
  • Pipeline composition
  • 194 tests with 90% coverage

📚 Full documentation available

Etymology

The name emic works on multiple levels:

  1. Acronym: Epsilon Machine Inference & Characterization
  2. Linguistic: In linguistics/anthropology, emic refers to analysis from within the system — understanding structure on its own terms. This resonates with computational mechanics: ε-machines reveal the intrinsic structure of a process.
  3. Phonetic: Pronounced "EE-mik" or "EH-mic" — a nod to "ε-machine"

References

Contributing

Contributions are welcome! See the Contributing Guide for details.

License

MIT License — see LICENSE for details.

Author

John Azariah (@johnazariah)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

emic-0.2.0.tar.gz (282.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

emic-0.2.0-py3-none-any.whl (68.2 kB view details)

Uploaded Python 3

File details

Details for the file emic-0.2.0.tar.gz.

File metadata

  • Download URL: emic-0.2.0.tar.gz
  • Upload date:
  • Size: 282.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for emic-0.2.0.tar.gz
Algorithm Hash digest
SHA256 570ba91e86fb01a36c64a6e322c8a5725578c1f01ced97c5d324b3d717cc5c61
MD5 5f8e898d50c4bd273e7302bf4a48c36b
BLAKE2b-256 6e7a6641273183807d61993d1d92051dae46358a6c778d9e0a31a3fe92b2f2e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for emic-0.2.0.tar.gz:

Publisher: release.yml on johnazariah/emic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file emic-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: emic-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 68.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for emic-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0924a1061405ad47b0b2e98de7adc5f3adf3717a1e7d96973717e63878efa9e6
MD5 2fe55413f0e84ef41e19e696bd71dd9f
BLAKE2b-256 6e313839191db1537ffc665e7b2d5943ea2ed72f145fb325a4d6080a5efed0f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for emic-0.2.0-py3-none-any.whl:

Publisher: release.yml on johnazariah/emic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page