Package: adamet
Adaptive Metropolis for Bayesian AnalysisAdaMet is a well-tested Python implementation byCappellari et al. (2013)of the Adaptive Metropolis algorithm byHaario H., Saksman E., Tamminen J. (2001).
It was used in a number of published papers in the astrophysics literature.ContentsAttributionInstallationDocumentationAdaMet PurposeUsage ExampleCalling SequenceInput ParametersOptional KeywordsOutput ParametersLicenseAttributionIf you use this software for your research, please cite at leastCappellari et al. (2013)where the implementation was introduced.
The BibTeX entry for the paper is:@ARTICLE{Cappellari2013a,
    author = {{Cappellari}, M. and {Scott}, N. and {Alatalo}, K. and
        {Blitz}, L. and {Bois}, M. and {Bournaud}, F. and {Bureau}, M. and
        {Crocker}, A.~F. and {Davies}, R.~L. and {Davis}, T.~A. and {de Zeeuw},
        P.~T. and {Duc}, P.-A. and {Emsellem}, E. and {Khochfar}, S. and
        {Krajnovi{\'c}}, D. and {Kuntschner}, H. and {McDermid}, R.~M. and
        {Morganti}, R. and {Naab}, T. and {Oosterloo}, T. and {Sarzi}, M. and
        {Serra}, P. and {Weijmans}, A.-M. and {Young}, L.~M.},
    title = "{The ATLAS$^{3D}$ project - XV. Benchmark for early-type
        galaxies scaling relations from 260 dynamical models: mass-to-light
        ratio, dark matter, Fundamental Plane and Mass Plane}",
    journal = {MNRAS},
    eprint = {1208.3522},
    year = 2013,
    volume = 432,
    pages = {1709-1741},
    doi = {10.1093/mnras/stt562}
}Installationinstall with:pip install adametWithout writing access to the globalsite-packagesdirectory, use:pip install --user adametDocumentationThe documentation is in the docstring of the fileadamet.pyor onPyPi.AdaMet PurposeThis is the implementation byCappellari et al. (2013)of the Adaptive Metropolis algorithm byHaario H., Saksman E., Tamminen J. (2001)for Bayesian analysis.Usage ExampleTo learn how to useAdaMetrun the example program in theadamet/examplesdirectory, within the main package installation
folder insidesite-packages, and read the detailed documentation
in the docstring of the fileadamet.pyor onPyPi.Note: For dimensions = 1 to 6, the optimal acceptance rates arerate = [0.441, 0.352, 0.316, 0.279, 0.275, 0.266]and the asymptotic value for many parameters is 23%Calling Sequencepars,lnprob=adamet(lnprob_fun,pars0,sigpars0,bounds,nstep,labels=None,nprint=100,quiet=False,fignum=None,plot=True,labels_scaling=1,seed=None,args=(),kwargs={})Input Parameterslnprob_fun: callableThis function returns the natural logarithm of the conditional
probability of the model, given the data:P(model | data) ~ P(data | model) P(model)pars0: array_like with shape (n,)vector with the mean of the multivariate Gaussian describing the
proposal distribution from which samples are drawn.
For maximum efficiency, this initial Gaussian should approximate the
posterior distribution. This suggests adopting aspars0an initial
guess for the model best-fitting parameters.sigpars0: array_like with shape (n,)vector with the dispersionsigmaof the multivariate Gaussian
describing the proposal distribution.
For maximum efficiency, this initial Gaussian should approximate the
posterior distribution. This suggests adopting assigparsan initial
guess of the uncertainty in the model parameterspars.bounds: 2-tuple of array_likeLower and upper bounds on independent variables. Each array must match
the size ofpars. The model probability is set to zero outside the
bounds. This keyword is also used to define the plotting ranges.nsteps: integerNumber of attempted moves in the chain. Typical numbers are a few
thousandsnsteps.Optional Keywordslabels: array_like with shape (n,)String labels for each parameter to be used in thecorner_plotnprint: integerSpecifies the frequency for the intermediate plots, in moves.
A typical value could benstep/10.plot: boolean, optionalSpecifies whether to show a plot of the results or not.fignum: integer, optionalSpecifies the figure number for the plot.labels_scaling: floatRelative scaling for the plotting labels.seed: integerSeed for the random generator. Specify this value for a repeatable
random sequence.args, kwargs: tuple and dict, optionalAdditional arguments passed tolnprob_fun. Both empty by default.
The calling signature islnprob_fun(x, *args, **kwargs).Output Parameterspars: array_like with shape (nsteps, n)Posterior distribution for the model parameterslnprob: array_like with shape (nsteps, n)Logarithm of the probbaility of the model, given the data, for each set
of parameters in the posterior distributionpars.LicenseOther/Proprietary LicenseCopyright (c) 2012-2020 Michele CappellariThis software is provided as is without any warranty whatsoever.
Permission to use, for non-commercial purposes is granted.
Permission to modify for personal or internal use is granted,
provided this copyright and disclaimer are included in all
copies of the software. All other rights are reserved.
In particular, redistribution of the code is not allowed.