MH

class sherpa.sim.mh.MH(fcn, sigma, mu, dof, *args, rng=None)[source] [edit on github]

Bases: Sampler

The Metropolis Hastings Sampler

Changed in version 4.16.0: The rng parameter was added.

Random number generation is controlled by the rng argument. If set to None (the default) then the routines from numpy.random are used, and so can be controlled by calling numpy.random.seed, otherwise it takes a numpy.random.Generator object (or a numpy.random.RandomState object which should only be used for testing or checking against old code).

Methods Summary

accept(current, current_stat, proposal, ...)

Should the proposal be accepted (using the Cash statistic and the t distribution)?

accept_mh(current, current_stat, proposal, ...)

calc_fit_stat(proposed_params)

calc_stat(proposed_params)

dmvt(x[, log, norm])

draw(current)

Create a new set of parameter values using the t distribution.

init([log, inv, defaultprior, priorshape, ...])

mh(current)

MH jumping rule

reject()

tear_down()

update(stat, mu[, init])

include prior

Methods Documentation

accept(current, current_stat, proposal, proposal_stat, **kwargs)[source] [edit on github]

Should the proposal be accepted (using the Cash statistic and the t distribution)?

accept_mh(current, current_stat, proposal, proposal_stat)[source] [edit on github]
calc_fit_stat(proposed_params)[source] [edit on github]
calc_stat(proposed_params)[source] [edit on github]
dmvt(x, log=True, norm=False)[source] [edit on github]
draw(current)[source] [edit on github]

Create a new set of parameter values using the t distribution.

Given the best-guess (mu) and current (current) set of parameters, along with the covariance matrix (sigma), return a new set of parameters.

init(log=False, inv=False, defaultprior=True, priorshape=False, priors=(), originalscale=True, scale=1, sigma_m=False)[source] [edit on github]
mh(current)[source] [edit on github]

MH jumping rule

reject()[source] [edit on github]
tear_down()[source] [edit on github]
update(stat, mu, init=True)[source] [edit on github]

include prior