Epsilon Machine Inference & Characterization - A framework for computational mechanics
Project description
emic
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 using multiple algorithms (CSSR, CSM, BSI, Spectral, NSD)
- 📊 Analysis: Compute complexity measures (Cμ, hμ, excess entropy, crypticity)
- 🎲 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
- 📝 Export: LaTeX tables, TikZ diagrams, DOT, Mermaid, and JSON formats
- 🧩 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, TakeN
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)
data = TakeN(10_000)(source)
# Infer the epsilon-machine using CSSR
config = CSSRConfig(max_history=5, significance=0.001)
result = CSSR(config).infer(data)
# 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, TakeN
from emic.inference import CSSR, CSSRConfig
from emic.analysis import analyze
# Compose source and transforms
source = GoldenMeanSource(p=0.5, _seed=42)
data = source >> TakeN(10_000)
# Infer and analyze
config = CSSRConfig(max_history=5, significance=0.001)
result = CSSR(config).infer(data)
summary = analyze(result.machine)
print(summary)
Built-in Sources
| 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:
- Multiple inference algorithms: CSSR, CSM, BSI, Spectral, NSD
- Full analysis suite (Cμ, hμ, excess entropy, crypticity)
- Synthetic and empirical data sources
- Pipeline composition
- 194 tests with 90% coverage
📚 Full documentation available
Etymology
The name emic works on multiple levels:
- Acronym: Epsilon Machine Inference & Characterization
- 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.
- Phonetic: Pronounced "EE-mik" or "EH-mic" — a nod to "ε-machine"
References
- Crutchfield, J.P. (1994). "The Calculus of Emergence: Computation, Dynamics, and Induction". Physica D.
- Shalizi, C.R. & Crutchfield, J.P. (2001). "Computational Mechanics: Pattern and Prediction, Structure and Simplicity". Journal of Statistical Physics.
- Crutchfield, J.P. & Young, K. (1989). "Inferring Statistical Complexity". Physical Review Letters.
Contributing
Contributions are welcome! See the Contributing Guide for details.
License
MIT License — see LICENSE for details.
Author
John Azariah (@johnazariah)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file emic-0.3.0.tar.gz.
File metadata
- Download URL: emic-0.3.0.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c5136d40b6567cf678ed4eaa38ef8353984e09ed18d5e23e7e3b67201c3f416
|
|
| MD5 |
0be22172f428b03efd68810de97ab364
|
|
| BLAKE2b-256 |
5c113442aaf1d30e2ea7ea79cfd9b72338fb005ffc0daa5c5118913f5d336ff1
|
Provenance
The following attestation bundles were made for emic-0.3.0.tar.gz:
Publisher:
release.yml on johnazariah/emic
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
emic-0.3.0.tar.gz -
Subject digest:
1c5136d40b6567cf678ed4eaa38ef8353984e09ed18d5e23e7e3b67201c3f416 - Sigstore transparency entry: 854792180
- Sigstore integration time:
-
Permalink:
johnazariah/emic@e09b7d6c4bdd08a4f0e7ea049eaa8cd38e11c6c8 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/johnazariah
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e09b7d6c4bdd08a4f0e7ea049eaa8cd38e11c6c8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file emic-0.3.0-py3-none-any.whl.
File metadata
- Download URL: emic-0.3.0-py3-none-any.whl
- Upload date:
- Size: 80.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4649be294ebef6cd92e964c2233ac16b8aab66f82c1a8ba8322a749ad860249
|
|
| MD5 |
644ece647d0bde193af9ba28106b77cf
|
|
| BLAKE2b-256 |
afdfd275777d44310a9b5b1ccea1b56bf94b783f974cececbf52ee1a086ac638
|
Provenance
The following attestation bundles were made for emic-0.3.0-py3-none-any.whl:
Publisher:
release.yml on johnazariah/emic
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
emic-0.3.0-py3-none-any.whl -
Subject digest:
f4649be294ebef6cd92e964c2233ac16b8aab66f82c1a8ba8322a749ad860249 - Sigstore transparency entry: 854792186
- Sigstore integration time:
-
Permalink:
johnazariah/emic@e09b7d6c4bdd08a4f0e7ea049eaa8cd38e11c6c8 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/johnazariah
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e09b7d6c4bdd08a4f0e7ea049eaa8cd38e11c6c8 -
Trigger Event:
push
-
Statement type: