def mcmc(transform, loglikelihood, parameter_names, nsteps=<NUM_LIT>, nburn=<NUM_LIT>, <EOL>stdevs=<NUM_LIT:0.1>, start = <NUM_LIT:0.5>, **problem):
if '<STR_LIT>' in problem:<EOL><INDENT>numpy.random.seed(problem['<STR_LIT>'])<EOL><DEDENT>n_params = len(parameter_names)<EOL>def like(cube):<EOL><INDENT>cube = numpy.array(cube)<EOL>if (cube <= <NUM_LIT>).any() or (cube >= <NUM_LIT:1>-<NUM_LIT>).any():<EOL><INDENT>return -<NUM_LIT><EOL><DEDENT>params = transform(cube)<EOL>return loglikelihood(params)<EOL><DEDENT>start = start + numpy.zeros(n_params)<EOL>stdevs = stdevs + numpy.zeros(n_params)<EOL>def compute_stepwidths(chain):<EOL><INDENT>return numpy.std(chain, axis=<NUM_LIT:0>) / <NUM_LIT:3><EOL><DEDENT>import matplotlib.pyplot as plt<EOL>plt.figure(figsize=(<NUM_LIT:7>, <NUM_LIT:7>))<EOL>steps = numpy.array([<NUM_LIT:0.1>]*(n_params))<EOL>print('<STR_LIT>')<EOL>chain, prob, _, steps_ = mcmc_advance(start, steps, like, nsteps=nburn / <NUM_LIT:2>, adapt=True)<EOL>steps = compute_stepwidths(chain)<EOL>print('<STR_LIT>')<EOL>chain, prob, _, steps_ = mcmc_advance(chain[-<NUM_LIT:1>], steps, like, nsteps=nburn / <NUM_LIT:2>, adapt=True)<EOL>steps = compute_stepwidths(chain)<EOL>print('<STR_LIT>')<EOL>chain, prob, _, steps_ = mcmc_advance(chain[-<NUM_LIT:1>], steps, like, nsteps=nsteps)<EOL>chain = numpy.array(chain)<EOL>i = numpy.argmax(prob)<EOL>final = chain[-<NUM_LIT:1>]<EOL>print('<STR_LIT>')<EOL>chain = numpy.array([transform(params) for params in chain])<EOL>return dict(start=chain[-<NUM_LIT:1>], maximum=chain[i], seeds=[final, chain[i]], chain=chain, method='<STR_LIT>')<EOL>
**Metropolis Hastings MCMC**

with automatic step width adaption. 
Burnin period is also used to guess steps.

:param nburn: number of burnin steps
:param stdevs: step widths to start with