-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,48 @@ | ||
# EmpiricalDistributions.jl | ||
|
||
A Julia package for empirical probability distributions that implement the | ||
[Distributions.jl](https://github.com/JuliaStats/Distributions.jl) API. | ||
|
||
This package currently provides uni- and multivariate binned distributions, | ||
backed by [StatsBase.jl](https://github.com/JuliaStats/StatsBase.jl) | ||
histograms. | ||
|
||
[`UvBinnedDist`](@ref) wraps a 1-dimensional histogram and presents it as | ||
a (binned) univariate continuous distribution: | ||
|
||
```julia | ||
using Distributions, StatsBase | ||
|
||
X_uv = rand(Normal(2.0, 0.5), 10^5) | ||
uvhist = fit(Histogram, X_uv) | ||
|
||
using EmpiricalDistributions | ||
|
||
uvdist = UvBinnedDist(uvhist) | ||
uvdist isa Distribution{Univariate,Continuous} | ||
``` | ||
|
||
The resulting distribution can be queried, used to generate random numbers, | ||
etc.: | ||
|
||
```julia | ||
mean(uvdist), var(uvdist) | ||
maximum(uvdist), minimum(uvdist) | ||
rand(uvdist, 5) | ||
``` | ||
|
||
[`MvBinnedDist`](@ref) does the same for a multi-dimensional histogram, | ||
and presents it as a (binned) multivariate continuous distribution: | ||
|
||
```julia | ||
X_mv = rand(MvNormal([3.5, 0.5], [2.0 0.5; 0.5 1.0]), 10^5) | ||
mvhist = fit(Histogram, (X_mv[1, :], X_mv[2, :])) | ||
|
||
using Distributions, EmpiricalDistributions | ||
|
||
mvdist = MvBinnedDist(mvhist) | ||
mvdist isa Distribution{Multivariate,Continuous} | ||
|
||
mean(mvdist), cov(mvdist) | ||
rand(mvdist, 5) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18ae5a9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
18ae5a9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/6129
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via: