Monte Carlo integration with Tensorflow
Project description
VegasFlow
VegasFlow is a Monte Carlo integration library written in Python and based on the TensorFlow framework. It is developed with a focus on speed and efficiency, enabling researchers to perform very expensive calculation as quick and easy as possible.
Some of the key features of VegasFlow are:
-
Integrates efficiently high dimensional functions on single (multi-threading) and multi CPU, single and multi GPU, many GPUs or clusters.
-
Compatible with Python, C, C++ or Fortran.
-
Implementation of different Monte Carlo algorithms.
Documentation
https://vegasflow.readthedocs.io/en/latest
Installation
The package can be installed with pip:
python3 -m pip install vegasflow
as well as conda
, from the conda-forge
channel:
conda install vegasflow -c conda-forge
If you prefer a manual installation you can clone the repository and run:
git clone https://github.com/N3PDF/vegasflow.git
cd vegasflow
python setup.py install
or if you are planning to extend or develop the code just use:
python setup.py develop
Examples
There are some examples in the examples/
folder.
Minimum Working Example
import tensorflow as tf
from vegasflow.vflow import vegas_wrapper
def integrand(x, **kwargs):
""" Function:
x_{1} * x_{2} ... * x_{n}
x: array of dimension (events, n)
"""
return tf.reduce_prod(x, axis=1)
dimensions = 8
iterations = 5
events_per_iteration = int(1e5)
vegas_wrapper(integrand, dimensions, iterations, events_per_iteration, compilable=True)
For more complicated examples please see the documentation or the examples folder.
Please feel free to open an issue if you would like some specific example or find any problems at all with the code or the documentation.
Citation policy
If you use the package please cite the following paper and zenodo references:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for vegasflow-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf196ac3c8a9b5ecc759d358e190704e7233ebc52d1847580cd7f63111fe8db7 |
|
MD5 | d92ef20ead7dccb59d0652bd6d72ae1d |
|
BLAKE2b-256 | 85fd91f2625087b2f220e64b7b24aa5faec057acbbc0fcb891d08116e98577f7 |