Skip to content

calebwin/margin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

Margin

Margin is an utterly useless compiler for Markov chains. You can specify your Markov chains as DOT graphs.

/* weather_markov_chain.dot */
digraph my_weather_markov_chain {
	"rain" -> "sunny" [label = 0.5];
	"hail" -> "snow" [label = 1.0];
	"rain" -> "hail" [label = 0.7];
}

Margin will then compile the graph to a Python implementation of the Markov chain in a class.

python margin.py weather_markov_chain.dot
# weather_markov_chain.py
class my_markov_chain:
	.
	.
	.

And you can use it as follows

my_weather_predictor = my_markov_chain("rain")
my_weather_predictor.step()

About

a Markov chain compiler for the DOT language

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages