Skip to main content

A-Machine

A-Machine is a library for constructing epsilon-machines1 and other stochastic models for generating structured symbol sequences. It was created with the goal of generating data with ground truth causal structure and information-theoretic complexity for studying neural network learning dynamics and internal representations.

See the documentation for more details.

This is an early work in progress. Much more to come.

Installation

# CPU only
pip install a-machine

# With cupy and cuvs support (requires CUDA 13)
pip install "a-machine[cuda]" --extra-index-url https://pypi.nvidia.com

# With transformers + torch (CPU), along with aim and datasets
pip install "a-machine[transformers]" --extra-index-url https://download.pytorch.org/whl/cpu

# With transformers + torch (CUDA 13.2) along with aim and datasets
pip install "a-machine[transformers]" --extra-index-url https://download.pytorch.org/whl/cu132

# With all
pip install "a-machine[all]" \
  --extra-index-url https://pypi.nvidia.com \
  --extra-index-url https://download.pytorch.org/whl/cu132

Quick Start

import amachine as am

# Seeds random and np.random globally (alternatively pass a random seed directly to random_machine)
am.srand_global( 42 )

# May have multiple recurrent subgraphs, terminal states, or tranistory states
m = am.random_machine( 
	n_states=23, 
	symbols=[ '0', '1' ],
	connectedness=0.35,
	randomness=0.25 )

# Collapse to the largest recurrent subgraph
m.collapse_to_largest_strongly_connected_subgraph()

# Minimize the machine in case it's not minimal -> epsilon-machine.
m.minimize( retain_names=True )

# Single symbol entropy, entropy rate, Statistical complexity
print( f"H(1) : {m.H_1():.3f}" )
print( f"h_mu : {m.h_mu():.3f}" )
print( f"C_mu : {m.C_mu():.3f}" )

# Excess entropy, transient information, synchronization information 
print( f"E : {m.E():.3f}" )
print( f"T : {m.T_inf():.3f}" )
print( f"S : {m.S():.3f}" )

# Crypticity
print( f"chi : {m.chi():.3f}" )

# Display the epislon machine
m.draw_graph(output_dir=".")

Author

Tyson A. Neuroth

tneuroth.gitlab.io

Citation

If you use this package in your research, please cite:

@software{a-machine,
  author = {Tyson A. Neuroth},
  title  = {A-Machine},
  year   = {2016},
  url    = {https://gitlab.com/tneuroth/a-machine}
}

License

MIT

References

  1. Crutchfield, James P., and Karl Young. "Inferring statistical complexity." Physical review letters 63.2 (1989): 105. ↩

Metadata

Release files for a-machine 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for a-machine 0.3.0
File Size Uploaded Provenance Actions
a_machine-0.3.0.tar.gz 13.0 MB Without provenance Details for a_machine-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for a-machine 0.3.0
File Interpreter ABI Platform Actions
a_machine-0.3.0-cp312-cp312-manylinux_2_34_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.34+ x86-64 Details for a_machine-0.3.0-cp312-cp312-manylinux_2_34_x86_64.whl

Total release size: 14.5 MB

Release files / a_machine-0.3.0.tar.gz

Download URL a_machine-0.3.0.tar.gz
Size 13.0 MB
Tags Source
SHA-256 checksum
How to use checksums
a7f359a7fb88b9dac0ed289d283165fa20598ea1e6f3ba804fc3ab547b4bb2c9
BLAKE2b-256 checksum
How to use checksums
13a74f18491a4413e615c168a07e09e9f14c9cd387483a8df5ad3cadcf8d12b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / a_machine-0.3.0-cp312-cp312-manylinux_2_34_x86_64.whl

Download URL a_machine-0.3.0-cp312-cp312-manylinux_2_34_x86_64.whl
Size 1.5 MB
Tags CPython 3.12 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
b0e5aa19c905d78bd2bfd54656dea2b93e43a5b2f8753e7a455fcd9cbb89fd6e
BLAKE2b-256 checksum
How to use checksums
911dcef3e0eeae5ec8ce25e20b17280f464b3ea7d807319f30bc1e81867d57f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for a-machine 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page