Skip to main content

Markov chains in pure python

Project description

marc

MIT Travis PyPI Downloads

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


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)

Uploaded Source

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

Hashes for marc-1.0.2.tar.gz
Algorithm Hash digest
SHA256 e56f2e9a8db065dc7d9984b6a598c28f478d3929f61428f422493fc4aaa58dad
MD5 166629a511ddcb49285f3db9d2831486
BLAKE2b-256 c369d890a4ee7facdb66645ebab3e99620d29635a75e517663f20898fb073d29

See more details on using hashes here.

Supported by

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