Skip to content

examples_of_MC_APIs

npalmer edited this page Jan 28, 2015 · 5 revisions

Examples of Scientific Computing APIs in Python

As a test case, we look for an example of a general Monte Carlo simulation in Python.

Many examples encountered are fairly specialized. A few good (i.e. easily generalizable) examples of APIs for scientific computing are:

  • Apache Commons Math Library

    • An open library in Java. The API is nearly the entire documentation system. An API such as this is easy to imitate with simpler Python, although the rigid (and extensive) structure imposed by Java may be excessive for our purposes.
  • GNU SciLib

    • The API is embedded in the code;
    • Nice guidelines for API and version numbers:

Use a meaningful version number which reflects the state of development Generally, 0.x are alpha versions, which provide no guarantees. Following that, 0.9.x are beta versions, which should be essentially complete, subject only to minor changes and bug fixes. The first major release is 1.0. Any version number of 1.0 or higher should be suitable for production use with a well-defined API. The API must not change in a major release and should be backwards-compatible in its behavior (excluding actual bug-fixes), so that existing code do not have to be modified. Note that the API includes all exported definitions, including data-structures defined with struct. If you need to change the API in a package, it requires a new major release (e.g. 2.0).

  • Emcee is a toolkit for Bayesian Markov Chain Monte Carlo estimation procedures. They have a nice example of a technical API published here.

  • The Thuban project has nice documentation for writing extensions; the sample code therein is close to what a Python API will likely look like.

  • OpenOpt develops generalized optimization routines for Python. They do not have an explict API but do have various structures for interfacing with the code. See more details below.

  • Our Python API attempts will almost certainly start simple and expand as we produce more examples of projects.

A number of promising project which have varying levels of APIs are noted below.

Notes on PyMC:

Some examples of it applied to computational problems:

Notes on Emcee:

"NLopt is a free/open-source library for nonlinear optimization, providing a common interface for a number of different free optimization routines available online as well as original implementations of various other algorithms. Its features include:

  • Callable from C, C++, Fortran, Matlab or GNU Octave, Python, GNU Guile, Julia, GNU R, Lua, and OCaml.

  • A common interface for many different algorithms—try a different algorithm just by changing one parameter.

  • Support for large-scale optimization (some algorithms scalable to millions of parameters and thousands of constraints).

  • Both global and local optimization algorithms.

  • Algorithms using function values only (derivative-free) and also algorithms exploiting user-supplied gradients.

  • Algorithms for unconstrained optimization, bound-constrained optimization, and general nonlinear inequality/equality constraints.

  • Free/open-source software under the GNU LGPL (and looser licenses for some portions of NLopt)."

  • Their Python API discussed briefly here

Notes on OpenOpt:

In R:

Stata Simulate and Bootstrap:

A Number of Misc Python Examples:

These are simply a number of examples of Python employed for Monte Carlo simulation.

Clone this wiki locally