Git Product home page Git Product logo

chaospy's Introduction

Chaospy

travis codecov pypi readthedocs

logo

Chaospy is a numerical tool for performing uncertainty quantification using polynomial chaos expansions and advanced Monte Carlo methods implemented in Python 2 and 3.

A article in Elsevier Journal of Computational Science has been published introducing the software: here. If you are to use this software in work that is published, please cite this paper.

Installation

Installation should be straight forward:

pip install chaospy

And you should be ready to go.

Alternatively, to get the most current experimental version, the code can be installed from Github as follows:

git clone [email protected]:jonathf/chaospy.git
cd chaospy
pip install -r requirements.txt
python setup.py install

The last command might need sudo prefix, depending on your python setup.

Optionally, to support more regression methods, install the Scikit-learn package:

pip install scikit-learn

Example Usage

chaospy is created to be simple and modular. A simple script to implement point collocation method will look as follows:

>>> import chaospy as cp
>>> import numpy as np

>>> def foo(coord, prm): # your code wrapper goes here
...     """Function to do uncertainty quantification on."""
...     return prm[0] * np.e ** (-prm[1] * np.linspace(0, 10, 100))

>>> distribution = cp.J(
...     cp.Uniform(1, 2),
...     cp.Uniform(0.1, 0.2)
... )

>>> polynomial_expansion = cp.orth_ttr(8, distribution)

>>> foo_approx = cp.fit_regression(
...     polynomial_expansion, samples, evals)

>>> expected = cp.E(foo_approx, distribution)
>>> deviation = cp.Std(foo_approx, distribution)

For a more extensive description of what going on, see the tutorial.

For a collection of recipes, see the cookbook.

Questions & Troubleshooting

For any problems and questions you might have related to chaospy, please feel free to file an issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.