对数蒙特卡罗

lmc的Python项目详细描述


ascl:1706.005PyPiLGPL-3.0

对数反蒙特卡罗(lmc)

马尔可夫链蒙特卡罗的python代码

Logarithmancy(n):通过算法的占卜

这是什么?

LMC(不要与大麦哲伦云混淆)是一组用于执行马尔可夫链蒙特卡罗的python代码,它实现了一些不同的多维建议策略和(可选的并行)自适应方法。在那里有类似的包,特别是pymc-^ tt1}$存在,因为我发现替代品对于我当时所做的工作来说太不灵活了。万一有人在同一条船上,就这样。

目前包括metropolis、slice和由emceeGoodman & Weare 2010)推广的仿射不变采样器。

此文件包的简要说明(从帮助功能)复制到:

The module should be very flexible, but is designed with these things foremost in mind:
 1. use with expensive likelihood calculations which probably have a host of hard-to-modify
    code associated with them.
 2. making it straightforward to break the parameter space into subspaces which can be sampled
    using different proposal methods and at different rates. For example, if changing some
    parameters requires very expensive calulations in the likelihood, the other, faster
    parameters can be sampled at a higher rate. Or, some parameters may lend themselves to
    Gibbs sampling, while others may not, and these can be block updated independently.
 3. keeping the overhead low to facilitate large numbers of parameters. Some of this has been
    lost in the port from C++, but, for example, the package provides automatic tuning of the
    proposal covariance for block updating without needing to store traces of the parameters in
    memory.

Real-valued parameters are usually assumed, but the framework can be used with other types of
parameters, with suitable overloading of classes.

A byproduct of item (1) is that the user is expected to handle all aspects of the calculation of
the posterior. The module doesn't implement assignment of canned, standard priors, or automatic
discovery of shortcuts like conjugate Gibbs sampling. The idea is that the user is in the best
position to know how the details of the likelihood and priors should be implemented.

Communication between parallel chains can significantly speed up convergence. In parallel mode,
adaptive Updaters use information from all running chains to tune their proposals, rather than
only from their own chain. The Gelman-Rubin convergence criterion (ratio of inter- to intra-chain
variances) for each free parameter is also calculated. Parallelization is implemented in two ways;
see ?Updater for instructions on using each.
 1. Via MPI (using mpi4py). MPI adaptations are synchronous: when a chain reaches a communication
    point, it stops until all chains have caught up.
 2. Via the filesystem. When a chain adapts, it will write its covariance information to a file. It
    will then read in any information from other chains that is present in similar files, and
    incorporate it when tuning. This process is asynchronous; chains will not wait for one another;
    they will simply adapt using whatever information has been shared at the time.

安装

自动

通过运行pip install lmc从pypi安装。

手册

下载lmc/lmc.py并将其放在PYTHONPATH中的某个位置。您需要安装numpy包。mpi4py包是可选的,但强烈建议使用。

用法和帮助

文档可以在lmc.py中找到,大部分是docstring形式的,因此也可以通过python解释器获得。还有一个help()函数(如果您正在浏览,则位于文件顶部附近)和一个example()函数(位于底部附近)。

示例也可以浏览here

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java关闭应用程序按钮Listener   Java中的多线程同步在Java示例中的思考   java如何查看Tomcat正在使用/访问的JAR?   java My代码在调用垃圾收集器后不会终止   多线程Java连接线程池和connectionfactory?   java在运行时修改JAR文件   java Android:使用光标时引发IllegaleException   在Netbeans中测试不可执行库的java?   泛型在参数上强制子类Java类型   spring Java:继承与依赖注入“自动连线”   javascript如何解析这个xml元素   java打印特定序列中的数组   带有ProcessingTimeSessionWindow的java Apache Flink自定义触发器   java如何配置消息驱动的Bean应用程序和Glassfish来使用来自远程MessageBroker的消息?