Markov chains in pure python
Project description
About
marc is a small, but flexible, library that implements Markov chains in pure python.
Usage
from marc import MarkovChain
chain = [
'Rock', 'Rock', 'Paper', 'Rock', 'Scissors',
'Paper', 'Paper', 'Paper', 'Scissors', 'Rock',
'Scissors', 'Scissors', 'Paper', 'Rock', 'Rock',
'Rock', 'Rock', 'Paper', 'Rock', 'Rock'
]
mc = MarkovChain(chain)
mc.next_state('Rock')
# 'Rock'
mc.generate_states('Paper', n=5)
# ['Scissors', 'Paper', 'Rock', 'Paper', 'Scissors']
mc.next_state('Scissors')
# 'Paper'
Install
pip install marc
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
marc-1.0.2.tar.gz
(2.3 kB
view details)
File details
Details for the file marc-1.0.2.tar.gz
.
File metadata
- Download URL: marc-1.0.2.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e56f2e9a8db065dc7d9984b6a598c28f478d3929f61428f422493fc4aaa58dad |
|
MD5 | 166629a511ddcb49285f3db9d2831486 |
|
BLAKE2b-256 | c369d890a4ee7facdb66645ebab3e99620d29635a75e517663f20898fb073d29 |