Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
A stochastic model describing a sequence of possible events in which the probability of each event depends only on the state attained in the previous event.
8
votes
Accepted
Implementation of a Markov Chain
import random
def Markov(text_file):
Python convention is to name function lowercase_with_underscores. I'd also probably have this function take a string as input rather then a filename. That way t …
2
votes
Small Markov chain Monte Carlo implementation
def mcmc(prior_dist, size=100000, burn=1000, thin=10, Z=3, N=10):
import random
from scipy.stats import binom
Don't import inside functions. It goes against python convention and is ineffici …