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()