montecarlomeasurements.jl

Propagation of distributions by Monte-Carlo sampling: Real number types with uncertainty represented by samples.

https://github.com/baggepinnen/montecarlomeasurements.jl

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.7%) to scientific vocabulary

Keywords

error-analysis error-propagation gpu-acceleration gpu-computing monte-carlo monte-carlo-sampling monte-carlo-simulation numeric-types particle-filter physical-quantities probability-distributions robust-optimization uncertainties uncertainty-propagation uncertainty-sampling

Keywords from Contributors

fluxes pde the-human-brain surrogate graphics tracer ocean-modelling climate-change standardization ensemble-learning
Last synced: 4 months ago · JSON representation ·

Repository

Propagation of distributions by Monte-Carlo sampling: Real number types with uncertainty represented by samples.

Basic Info
Statistics
  • Stars: 278
  • Watchers: 6
  • Forks: 18
  • Open Issues: 25
  • Releases: 105
Topics
error-analysis error-propagation gpu-acceleration gpu-computing monte-carlo monte-carlo-sampling monte-carlo-simulation numeric-types particle-filter physical-quantities probability-distributions robust-optimization uncertainties uncertainty-propagation uncertainty-sampling
Created over 6 years ago · Last pushed 5 months ago
Metadata Files
Readme License Citation

README.md

logo Build Status codecov Documentation, stable Documentation, latest arXiv article

Imagine you had a type that behaved like your standard Float64 but it really represented a probability distribution like Gamma(0.5) or MvNormal(m, S). Then you could call y=f(x) and have y be the probability distribution y=p(f(x)). This package gives you such a type.

This package facilitates working with probability distributions by means of Monte-Carlo methods, in a way that allows for propagation of probability distributions through functions. This is useful for, e.g., nonlinear uncertainty propagation. A variable or parameter might be associated with uncertainty if it is measured or otherwise estimated from data. We provide two core types to represent probability distributions: Particles and StaticParticles, both <: Real. (The name "Particles" comes from the particle-filtering literature.) These types all form a Monte-Carlo approximation of the distribution of a floating point number, i.e., the distribution is represented by samples/particles. Correlated quantities are handled as well, see multivariate particles below.

Although several interesting use cases for doing calculations with probability distributions have popped up (see Examples), the original goal of the package is similar to that of Measurements.jl, to propagate the uncertainty from input of a function to the output. The difference compared to a Measurement is that Particles represent the distribution using a vector of unweighted particles, and can thus represent arbitrary distributions and handle nonlinear uncertainty propagation well. Functions like f(x) = x², f(x) = sign(x) at x=0 and long-time integration, are examples that are not handled well using linear uncertainty propagation ala Measurements.jl. MonteCarloMeasurements also support correlations between quantities.

A number of type Particles behaves just as any other Number while partaking in calculations. Particles also behave like a distribution, so after a calculation, an approximation to the complete distribution of the output is captured and represented by the output particles. mean, std etc. can be extracted from the particles using the corresponding functions pmean and pstd. Particles also interact with Distributions.jl, so that you can call, e.g., Normal(p) and get back a Normal type from distributions or fit(Gamma, p) to get a Gammadistribution. Particles can also be asked for maximum/minimum, quantile etc. using functions with a prefix p, i.e., pmaximum. If particles are plotted with plot(p), a histogram is displayed. This requires Plots.jl. A kernel-density estimate can be obtained by density(p) is StatsPlots.jl is loaded.

Below, we show an example where an input uncertainty is propagated through σ(x)

transformed densities

In the figure above, we see the probability-density function of the input p(x) depicted on the x-axis. The density of the output p(y) = f(x) is shown on the y-axis. Linear uncertainty propagation does this by linearizing f(x) and using the equations for an affine transformation of a Gaussian distribution, and hence produces a Gaussian approximation to the output density. The particles form a sampled approximation of the input density p(x). After propagating them through f(x), they form a sampled approximation to p(y) which correspond very well to the true output density, even though only 20 particles were used in this example. The figure can be reproduced by examples/transformed_densities.jl.

Quick start

```julia using MonteCarloMeasurements, Plots a = π ± 0.1 # Construct Gaussian uncertain parameters using ± (\pm)

Particles{Float64,2000}

3.14159 ± 0.1

b = 2 ∓ 0.1 # ∓ (\mp) creates StaticParticles (with StaticArrays)

StaticParticles{Float64,100}

2.0 ± 0.0999

pstd(a) # Ask about statistical properties

0.09999231528930486

sin(a) # Use them like any real number

Particles{Float64,2000}

1.2168e-16 ± 0.0995

plot(a) # Plot them b = sin.(1:0.1:5) .± 0.1; # Create multivariate uncertain numbers plot(b) # Vectors of particles can be plotted using Distributions c = Particles(500, Poisson(3.)) # Create uncertain numbers distributed according to a given distribution

Particles{Int64,500}

2.882 ± 1.7

```

For further help, see the documentation, the examples folder or the arXiv paper.

Owner

  • Name: Fredrik Bagge Carlson
  • Login: baggepinnen
  • Kind: user
  • Location: Lund, Sweden

Control systems, system identification, signal processing and machine learning

Citation (CITATION.bib)

@article{bagge2020MCM.jl,
    title         ={MonteCarloMeasurements.jl: Nonlinear Propagation of Arbitrary Multivariate Distributions by means of Method Overloading},
    author        ={Bagge Carlson, Fredrik},
    year          ={2020},
    eprint        ={2001.07625},
    archivePrefix ={arXiv},
    url           = {https://github.com/baggepinnen/MonteCarloMeasurements.jl},
    primaryClass  ={cs.MS}
}

GitHub Events

Total
  • Create event: 23
  • Commit comment event: 3
  • Release event: 8
  • Issues event: 12
  • Watch event: 15
  • Delete event: 11
  • Issue comment event: 73
  • Push event: 74
  • Pull request review event: 2
  • Pull request review comment event: 2
  • Pull request event: 38
  • Fork event: 1
Last Year
  • Create event: 23
  • Commit comment event: 3
  • Release event: 8
  • Issues event: 12
  • Watch event: 15
  • Delete event: 11
  • Issue comment event: 73
  • Push event: 74
  • Pull request review event: 2
  • Pull request review comment event: 2
  • Pull request event: 38
  • Fork event: 1

Committers

Last synced: almost 2 years ago

All Time
  • Total Commits: 440
  • Total Committers: 11
  • Avg Commits per committer: 40.0
  • Development Distribution Score (DDS): 0.448
Past Year
  • Commits: 26
  • Committers: 3
  • Avg Commits per committer: 8.667
  • Development Distribution Score (DDS): 0.077
Top Committers
Name Email Commits
Fredrik Bagge Carlson b****n@g****m 243
Fredrik Bagge Carlson c****b@u****g 171
github-actions[bot] 4****] 12
simeonschaub s****9@g****m 5
Seth Axen s****n@g****m 3
Floris van Kempen f****n@g****m 1
Mason Protter m****r@i****m 1
CompatHelper Julia c****y@j****g 1
Joachim Brand j****d@m****z 1
Simon Treillou 6****u 1
Julia TagBot 5****t 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 60
  • Total pull requests: 101
  • Average time to close issues: 20 days
  • Average time to close pull requests: 17 days
  • Total issue authors: 28
  • Total pull request authors: 16
  • Average comments per issue: 7.95
  • Average comments per pull request: 1.42
  • Merged pull requests: 80
  • Bot issues: 0
  • Bot pull requests: 27
Past Year
  • Issues: 10
  • Pull requests: 39
  • Average time to close issues: 6 days
  • Average time to close pull requests: 10 days
  • Issue authors: 5
  • Pull request authors: 5
  • Average comments per issue: 1.1
  • Average comments per pull request: 1.21
  • Merged pull requests: 30
  • Bot issues: 0
  • Bot pull requests: 12
Top Authors
Issue Authors
  • baggepinnen (9)
  • arbenede (6)
  • jonniedie (5)
  • aplavin (4)
  • cscherrer (4)
  • mauro3 (4)
  • MartinOtter (3)
  • florian-die (2)
  • klaff (2)
  • DilumAluthge (2)
  • MasonProtter (2)
  • sethaxen (1)
  • hzgzh (1)
  • JuliaTagBot (1)
  • zwwi (1)
Pull Request Authors
  • baggepinnen (45)
  • github-actions[bot] (26)
  • aplavin (14)
  • simeonschaub (3)
  • alhirzel (3)
  • abhro (2)
  • gdalle (2)
  • ChrisRackauckas (1)
  • sethaxen (1)
  • joachimbrand (1)
  • DilumAluthge (1)
  • SimonTreillou (1)
  • MasonProtter (1)
  • florisvankempen (1)
  • albheim (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • julia 517 total
  • Total dependent packages: 31
  • Total dependent repositories: 0
  • Total versions: 107
juliahub.com: MonteCarloMeasurements

Propagation of distributions by Monte-Carlo sampling: Real number types with uncertainty represented by samples.

  • Versions: 107
  • Dependent Packages: 31
  • Dependent Repositories: 0
  • Downloads: 517 Total
Rankings
Dependent packages count: 2.3%
Stargazers count: 3.1%
Average: 6.4%
Dependent repos count: 9.9%
Forks count: 10.4%
Last synced: 4 months ago