-
Notifications
You must be signed in to change notification settings - Fork 3
examples_of_MC_APIs
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:
-
- 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.
-
- 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.
Some examples of it applied to computational problems:
-
Nice simple examples which suggest possible api-style approaches:
-
Application to a successful Astrophysics project:
-
Tutorial chapter on model fitting, which contains the "sample" method and others -- key for our possible similar code. The method we care about here appears to be "Sampler:"
-
Nice general tutorial on Bayesian MCMC:
-
Their actual API.
-
Technical references:
- MacKay's Information Theory, Inference, and Learning Algorithms -- note that author posts book free online.
- Paper explaining the process: http://arxiv.org/abs/1202.3665
-
examples:
"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
- Main page
-
OpenOpt framework description
- Framework documentation (can be hard to ID on main page)
-
FuncDesigner description
- FuncDesigner documentation](http://openopt.org/FuncDesignerDoc) (can be hard to ID on main page)
- Note that this doesn't have a nice clean example of an API.
-
Stata's "simulate" command in R as SimpleSim, as well as an additional example of usage.
-
UCLA R FAQ: R bootstrap library, Bootstrap examples
-
UCLA Stata FAQ: Simulate
-
UCLA Stats FAQ: own bootstrap in Stata
These are simply a number of examples of Python employed for Monte Carlo simulation.
- https://www.chrisstucchio.com/blog/2013/basic_income_vs_basic_job.html
- Monte Carlo Simulation with Cython
-
PySpecKit, an extensible spectroscopic analysis toolkit for astronomy.
- application of MC: Monte Carlo Examples
Bottom-Up Approach
- Overview
- Presentation [ pdf ]
- Suggested Modules List
- Examples in Progress
- Replication Wishlist
- Important Questions
Top-Down Approach
- Overview
- Top-down-topics
- Extending the Dolo or Dynare languages
- Replication Wishlist
- Important Questions
Participation and E-Publication
Lessons from Open Source
Languages and Tools
Related Groups and Conferences
- Zotero Reading List
- SCE
- SED
Notes and Archives
In Progress