Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dmetivie committed Jan 20, 2023
2 parents 39ff7a5 + 43df4c9 commit a10b518
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,30 @@ To work, the only requirements are that the `dist<:Distribution` considered has
1. `logpdf(dist, y)` (used in the E-step)
2. `fit_mle(dist, y, weigths)` (used in the M-step)

In general 1. is easy, while 2. is only known explicitly for a few common distributions.
In case 2. is not explicit known, you can always implement a numerical scheme, if it exists, for `fit_mle(dist, y)` see [`Gamma` distribution example](https://github.com/JuliaStats/Distributions.jl/blob/34a05d8a1671052624e7fa246b58484acc32cfe5/src/univariate/continuous/gamma.jl#L171).
Or, when possible, represent your “difficult” distribution as a mixture of simple terms.
(I had [this](https://stats.stackexchange.com/questions/63647/estimating-parameters-of-students-t-distribution) in mind, but it is not directly a mixture model.)
Due to [Julia](https://julialang.org/) amazing [multiple dispatch](https://www.youtube.com/watch?v=kc9HwsxE1OY) systems and the [Distributions](https://juliastats.org/Distributions.jl/stable/) package, the code is very generic i.e., a lot of mixture should work:

- Univariate continuous distributions
- Univariate discrete distributions
- Multivariate distributions (continuous or discrete).
- Mixture of mixture (univariate or multivariate and continuous or discrete). Note that [Distributions](https://juliastats.org/Distributions.jl/stable/) currently does not allow `MixtureModel` to have discrete and continuous components (but who does that? Rain).

**Have a look at the tests sections to see examples**.

To work, the only requirements are that the `dist<:Distribution` considered has implanted

1. `logpdf(dist, y)` (used in the E-step)
2. `fit_mle(dist, y, weigths)` (used in the M-step)

In general 1. is easy, while 2. is only known explicitly for a few common distributions.
In case 2. is not explicit known, you can always implement a numerical scheme, if it exists, for `fit_mle(dist, y)` see [`Gamma` distribution example](https://github.com/JuliaStats/Distributions.jl/blob/34a05d8a1671052624e7fa246b58484acc32cfe5/src/univariate/continuous/gamma.jl#L171).
Or, when possible, represent your “difficult” distribution as a mixture of simple terms.
(I had [this](https://stats.stackexchange.com/questions/63647/estimating-parameters-of-students-t-distribution) in mind, but it is not directly a mixture model.)

## TODO (feel free to contribute)
## TODO (feel free to contribute)

- Add different variants for E-step and M-steps like stochastic EM and others.
Expand Down Expand Up @@ -70,4 +89,5 @@ isapprox(α, p[2][1]; rtol = rtol)
isapprox(θ₂, p[2][2]; rtol = rtol)
```


![EM_mixture_example.svg](img/EM_mixture_example.svg)

0 comments on commit a10b518

Please sign in to comment.