a-machine
توضیحات
Construct epsilon-machines to generate symbol sequences with ground truth causal structure and information-theoretic complexity for studying neural network learning dynamics.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | a-machine-0.3.0 |
| نام | a-machine |
| نسخه کتابخانه | 0.3.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | - |
| ایمیل نویسنده | "Tyson A. Neuroth" <tyneuroth@gmail.com> |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/a-machine/ |
| مجوز | - |
# A-Machine
A-Machine is a library for constructing epsilon-machines[^1] 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](https://tneuroth.gitlab.io/a-machine/amachine.html#what-is-a-machine) for more details.
This is an early work in progress. Much more to come.
## Installation
```bash
# 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
```python
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](https://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.
نیازمندی
| مقدار | نام |
|---|---|
| - | hnswlib |
| - | matplotlib |
| - | networkx |
| - | numpy |
| - | orjson |
| - | pyarrow |
| - | scikit-umfpack |
| - | scipy |
| - | graphviz>=0.21 |
| - | automata-lib>=9.2.0 |
| - | sympy>=1.14.0 |
| - | pdoc>=16.0.0 |
| - | nanobind>=2.12.0 |
| - | imageio[ffmpeg]>=2.37.3 |
| - | python-ternary>=1.0.8 |
| - | ortools |
| - | numba>=0.65.1 |
| - | pytoulbar2>=1.3.0 |
| - | openai>=3.3.1 |
| - | nltk>=3.10.3 |
| - | spacy>=3.8.15 |
| - | lemminflect>=0.2.3 |
| - | word-forms>=2.1.0 |
| - | pydantic-settings>=2.15.0 |
| - | pyenchant>=3.3.0 |
| - | unidecode>=1.4.0 |
| xtr | cupy-cuda13x>=14.0.1; |
| xtr | cuvs-cu13==26.4.*; |
| xtr | transformers>=5.14.1; |
| xtr | datasets>=4.8.5; |
| xtr | torch; |
| xtr | pytest; |
| xtr | aim; |
| xtr | nnsight; |
| xtr | pytorch-optimizer; |
| xtr | fastapi; |
| xtr | uvicorn; |
| xtr | pydantic; |
| xtr | orjson; |
| xtr | a-machine[app,cuda,transformers]; |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.12 | Python |
نحوه نصب
نصب پکیج whl a-machine-0.3.0:
pip install a-machine.whl
نصب پکیج tar.gz a-machine-0.3.0:
pip install a-machine.tar.gz