reddemcee


Namereddemcee JSON
Version 0.6.3 PyPI version JSON
download
home_pageNone
SummaryAn Adaptative Parallel Tempering wrapper for emcee 3 for personal use
upload_time2024-05-24 19:23:11
maintainerNone
docs_urlNone
authorReddTea
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Reddemcee

An Adaptative Parallel Tempering wrapper for emcee 3 for personal use, which
someone in the community might find useful on it's own.

# Overview
Reddemcee is simply a wrapper for the excellent MCMC implementation [emcee](https://arxiv.org/abs/1202.3665),
that contains an adaptative parallel tempering version of the sampler, according to [Vousden et al. implementation](https://arxiv.org/abs/1501.05823).
It's coded in such a way that minimal differences in input are required, and it's
fully compatible with emcee (v. 3.1.3).

# Dependencies

This code makes use of:
  - Numpy
  - pandas
  - tqdm (https://pypi.python.org/pypi/tqdm)
  - emcee (https://github.com/dfm/emcee)

Most of them come with conda, if some are missing they can be easily installed with pip.

# Installation

In the console type in your work folder
```sh
pip install reddemcee
```

# Usage

Please refer to the test file in the tests folder.

```python
import numpy as np
import reddemcee

def log_like(x, ivar):
    return -0.5 * np.sum(ivar * x ** 2)

def log_prior(x):
    return 0.0

ndim, nwalkers = 5, 100
ntemps = 5
ivar = 1. / np.random.rand(ndim)
p0 = list(np.random.randn(10, nwalkers, ndim))
sampler = reddemcee.PTSampler(nwalkers,
                             ndim,
                             log_like,
                             log_prior,
                             ntemps=ntemps,
                             adaptative=True,
                             logl_args=[ivar],
                             )
                             
sampler.run_mcmc(p0, 100, 2)  # starting pos, nsweeps, nsteps
```

# Additional Options

ntemps
betas
pool
adaptative
config_adaptation_halflife rn: adaptations reduced by half at this time
config_adaptation_rate     rn: smaller, faster
moves
backend

## Stored
ratios
betas_history
betas_history_bool
ratios_history

## Funcs
thermodynamic_integration(self,
                          coef=3,
                          sampler_dict = {'flat':False,
                                          'discard':10})

get_Z(discard=1, coef=3, largo=100)
get_attr(x)
get_func(x)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "reddemcee",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "ReddTea",
    "author_email": "redd@tea.com",
    "download_url": "https://files.pythonhosted.org/packages/b1/07/5d61177824c781ea43a324f888abb28a0336920feb0e07e847c43097a807/reddemcee-0.6.3.tar.gz",
    "platform": null,
    "description": "# Reddemcee\n\nAn Adaptative Parallel Tempering wrapper for emcee 3 for personal use, which\nsomeone in the community might find useful on it's own.\n\n# Overview\nReddemcee is simply a wrapper for the excellent MCMC implementation [emcee](https://arxiv.org/abs/1202.3665),\nthat contains an adaptative parallel tempering version of the sampler, according to [Vousden et al. implementation](https://arxiv.org/abs/1501.05823).\nIt's coded in such a way that minimal differences in input are required, and it's\nfully compatible with emcee (v. 3.1.3).\n\n# Dependencies\n\nThis code makes use of:\n  - Numpy\n  - pandas\n  - tqdm (https://pypi.python.org/pypi/tqdm)\n  - emcee (https://github.com/dfm/emcee)\n\nMost of them come with conda, if some are missing they can be easily installed with pip.\n\n# Installation\n\nIn the console type in your work folder\n```sh\npip install reddemcee\n```\n\n# Usage\n\nPlease refer to the test file in the tests folder.\n\n```python\nimport numpy as np\nimport reddemcee\n\ndef log_like(x, ivar):\n    return -0.5 * np.sum(ivar * x ** 2)\n\ndef log_prior(x):\n    return 0.0\n\nndim, nwalkers = 5, 100\nntemps = 5\nivar = 1. / np.random.rand(ndim)\np0 = list(np.random.randn(10, nwalkers, ndim))\nsampler = reddemcee.PTSampler(nwalkers,\n                             ndim,\n                             log_like,\n                             log_prior,\n                             ntemps=ntemps,\n                             adaptative=True,\n                             logl_args=[ivar],\n                             )\n                             \nsampler.run_mcmc(p0, 100, 2)  # starting pos, nsweeps, nsteps\n```\n\n# Additional Options\n\nntemps\nbetas\npool\nadaptative\nconfig_adaptation_halflife rn: adaptations reduced by half at this time\nconfig_adaptation_rate     rn: smaller, faster\nmoves\nbackend\n\n## Stored\nratios\nbetas_history\nbetas_history_bool\nratios_history\n\n## Funcs\nthermodynamic_integration(self,\n                          coef=3,\n                          sampler_dict = {'flat':False,\n                                          'discard':10})\n\nget_Z(discard=1, coef=3, largo=100)\nget_attr(x)\nget_func(x)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "An Adaptative Parallel Tempering wrapper for emcee 3 for personal use",
    "version": "0.6.3",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "45acbbd4311d3fe57e325ca77e737a34b1689f3e48ed6c1222146fbce76c0989",
                "md5": "38ebe821f7b31a32c813f06c9bd1765c",
                "sha256": "c0114ccdb48e67f7c6bc560b3cccd55991609f3eaa0c304ee3da9746de370f35"
            },
            "downloads": -1,
            "filename": "reddemcee-0.6.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "38ebe821f7b31a32c813f06c9bd1765c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 7884,
            "upload_time": "2024-05-24T19:23:09",
            "upload_time_iso_8601": "2024-05-24T19:23:09.346369Z",
            "url": "https://files.pythonhosted.org/packages/45/ac/bbd4311d3fe57e325ca77e737a34b1689f3e48ed6c1222146fbce76c0989/reddemcee-0.6.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b1075d61177824c781ea43a324f888abb28a0336920feb0e07e847c43097a807",
                "md5": "12eeec0596d8965af26f8cf661189e6b",
                "sha256": "068155d5a0b2a70e6f7fbedccc4d80821d708b9e2eb4fc0c8a3822935c037f0d"
            },
            "downloads": -1,
            "filename": "reddemcee-0.6.3.tar.gz",
            "has_sig": false,
            "md5_digest": "12eeec0596d8965af26f8cf661189e6b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 8727,
            "upload_time": "2024-05-24T19:23:11",
            "upload_time_iso_8601": "2024-05-24T19:23:11.176642Z",
            "url": "https://files.pythonhosted.org/packages/b1/07/5d61177824c781ea43a324f888abb28a0336920feb0e07e847c43097a807/reddemcee-0.6.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-24 19:23:11",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "reddemcee"
}
        
Elapsed time: 1.03219s