All Projects → crflynn → Stochastic

crflynn / Stochastic

Licence: mit
Generate realizations of stochastic processes in python.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Stochastic

Mathematics
数学知识点滴积累 矩阵 数值优化 神经网络反向传播 图优化 概率论 随机过程 卡尔曼滤波 粒子滤波 数学函数拟合
Stars: ✭ 417 (+110.61%)
Mutual labels:  probability
Distribution Is All You Need
The basic distribution probability Tutorial for Deep Learning Researchers
Stars: ✭ 1,109 (+460.1%)
Mutual labels:  probability
Awesome Machine Learning Deep Learning Mathematics
A curated list of mathematics documents ,Concepts, Study Materials , Algorithms and Codes available across the internet for machine learning and deep learning
Stars: ✭ 138 (-30.3%)
Mutual labels:  probability
Python For Probability Statistics And Machine Learning
Jupyter Notebooks for Springer book "Python for Probability, Statistics, and Machine Learning"
Stars: ✭ 481 (+142.93%)
Mutual labels:  probability
Quant Finance Resources
Courses, Articles and many more which can help beginners or professionals.
Stars: ✭ 36 (-81.82%)
Mutual labels:  probability
Ceramist
Verified hash-based AMQ structures in Coq
Stars: ✭ 107 (-45.96%)
Mutual labels:  probability
Normalizing flows
Pytorch implementations of density estimation algorithms: BNAF, Glow, MAF, RealNVP, planar flows
Stars: ✭ 356 (+79.8%)
Mutual labels:  probability
Quant Notes
Quantitative Interview Preparation Guide, updated version here ==>
Stars: ✭ 180 (-9.09%)
Mutual labels:  probability
Dnest4
Diffusive Nested Sampling
Stars: ✭ 49 (-75.25%)
Mutual labels:  probability
Flex
Probabilistic deep learning for data streams.
Stars: ✭ 127 (-35.86%)
Mutual labels:  probability
Prob140 Textbook Zh
📖 [译] 面向数据科学的概率论
Stars: ✭ 535 (+170.2%)
Mutual labels:  probability
Uc Davis Cs Exams Analysis
📈 Regression and Classification with UC Davis student quiz data and exam data
Stars: ✭ 33 (-83.33%)
Mutual labels:  probability
Ptstat
Probabilistic Programming and Statistical Inference in PyTorch
Stars: ✭ 108 (-45.45%)
Mutual labels:  probability
Teaching
Teaching Materials for Dr. Waleed A. Yousef
Stars: ✭ 435 (+119.7%)
Mutual labels:  probability
Math Php
Powerful modern math library for PHP: Features descriptive statistics and regressions; Continuous and discrete probability distributions; Linear algebra with matrices and vectors, Numerical analysis; special mathematical functions; Algebra
Stars: ✭ 2,009 (+914.65%)
Mutual labels:  probability
Stats Maths With Python
General statistics, mathematical programming, and numerical/scientific computing scripts and notebooks in Python
Stars: ✭ 381 (+92.42%)
Mutual labels:  probability
Ethzcheatsheets
Stars: ✭ 92 (-53.54%)
Mutual labels:  probability
Math Finance Cheat Sheet
Mathematical finance cheat sheet.
Stars: ✭ 186 (-6.06%)
Mutual labels:  probability
Stat Cookbook
📙 The probability and statistics cookbook
Stars: ✭ 1,990 (+905.05%)
Mutual labels:  probability
Gpnd
Generative Probabilistic Novelty Detection with Adversarial Autoencoders
Stars: ✭ 112 (-43.43%)
Mutual labels:  probability

stochastic

|travis| |rtd| |codecov| |pypi| |pyversions|

.. |travis| image:: https://img.shields.io/travis/crflynn/stochastic.svg :target: https://travis-ci.org/crflynn/stochastic

.. |rtd| image:: https://img.shields.io/readthedocs/stochastic.svg :target: http://stochastic.readthedocs.io/en/latest/

.. |codecov| image:: https://codecov.io/gh/crflynn/stochastic/branch/master/graphs/badge.svg :target: https://codecov.io/gh/crflynn/stochastic

.. |pypi| image:: https://img.shields.io/pypi/v/stochastic.svg :target: https://pypi.python.org/pypi/stochastic

.. |pyversions| image:: https://img.shields.io/pypi/pyversions/stochastic.svg :target: https://pypi.python.org/pypi/stochastic

A python package for generating realizations of stochastic processes.

Installation

The stochastic package is available on pypi and can be installed using pip

.. code-block:: shell

pip install stochastic

Dependencies


Stochastic uses ``numpy`` for many calculations and ``scipy`` for sampling
specific random variables.

Processes
---------

This package offers a number of common discrete-time, continuous-time, and
noise process objects for generating realizations of stochastic processes as
``numpy`` arrays.

The diffusion processes are approximated using the Euler–Maruyama method.

Here are the currently supported processes and their class references within
the package.

* stochastic.processes

    * continuous

        * BesselProcess
        * BrownianBridge
        * BrownianExcursion
        * BrownianMeander
        * BrownianMotion
        * CauchyProcess
        * FractionalBrownianMotion
        * GammaProcess
        * GeometricBrownianMotion
        * InverseGaussianProcess
        * MixedPoissonProcess
        * MultifractionalBrownianMotion
        * PoissonProcess
        * SquaredBesselProcess
        * VarianceGammaProcess
        * WienerProcess

    * diffusion

        * DiffusionProcess (generalized)
        * ConstantElasticityVarianceProcess
        * CoxIngersollRossProcess
        * ExtendedVasicekProcess
        * OrnsteinUhlenbeckProcess
        * VasicekProcess

    * discrete

        * BernoulliProcess
        * ChineseRestaurantProcess
        * DirichletProcess
        * MarkovChain
        * MoranProcess
        * RandomWalk

    * noise

        * BlueNoise
        * BrownianNoise
        * ColoredNoise
        * PinkNoise
        * RedNoise
        * VioletNoise
        * WhiteNoise
        * FractionalGaussianNoise
        * GaussianNoise

Usage patterns
--------------

Sampling
~~~~~~~~

To use ``stochastic``, import the process you want and instantiate with the
required parameters. Every process class has a ``sample`` method for generating
realizations. The ``sample`` methods accept a parameter ``n`` for the quantity
of steps in the realization, but others (Poisson, for instance) may take
additional parameters. Parameters can be accessed as attributes of the
instance.

.. code-block:: python

    from stochastic.processes.discrete import BernoulliProcess


    bp = BernoulliProcess(p=0.6)
    s = bp.sample(16)
    success_probability = bp.p


Continuous processes provide a default parameter, ``t``, which indicates the
maximum time of the process realizations. The default value is 1. The sample
method will generate ``n`` equally spaced increments on the
interval ``[0, t]``.

Sampling at specific times

Some continuous processes also provide a sample_at() method, in which a sequence of time values can be passed at which the object will generate a realization. This method ignores the parameter, t, specified on instantiation.

.. code-block:: python

from stochastic.processes.continuous import BrownianMotion


bm = BrownianMotion(drift=1, scale=1, t=1)
times = [0, 3, 10, 11, 11.2, 20]
s = bm.sample_at(times)

Sample times


Continuous processes also provide a method ``times()`` which generates the time
values (using ``numpy.linspace``) corresponding to a realization of ``n``
steps. This is particularly useful for plotting your samples.


.. code-block:: python

    import matplotlib.pyplot as plt
    from stochastic.processes.continuous import FractionalBrownianMotion


    fbm = FractionalBrownianMotion(hurst=0.7, t=1)
    s = fbm.sample(32)
    times = fbm.times(32)

    plt.plot(times, s)
    plt.show()


Specifying an algorithm

Some processes provide an optional parameter algorithm, in which one can specify which algorithm to use to generate the realization using the sample() or sample_at() methods. See the documentation for process-specific implementations.

.. code-block:: python

from stochastic.processes.noise import FractionalGaussianNoise


fgn = FractionalGaussianNoise(hurst=0.6, t=1)
s = fgn.sample(32, algorithm='hosking')
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].