https://github.com/beliavsky/normalmix1d
Fit a univariate mixture of normals to simulated data using the EM algorithm
https://github.com/beliavsky/normalmix1d
em-algorithm finite-mixture finite-mixture-models gaussian-mixture-models mixture-of-gaussians mixture-of-normals
Last synced: 3 months ago
JSON representation
Fit a univariate mixture of normals to simulated data using the EM algorithm
- Host: GitHub
- URL: https://github.com/beliavsky/normalmix1d
- Owner: Beliavsky
- License: mit
- Created: 2024-08-22T05:57:18.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-22T06:05:36.000Z (about 1 year ago)
- Last Synced: 2025-03-25T08:25:34.807Z (7 months ago)
- Topics: em-algorithm, finite-mixture, finite-mixture-models, gaussian-mixture-models, mixture-of-gaussians, mixture-of-normals
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NormalMix1D
Fit a univariate mixture of normals to simulated data using the EM algorithm, "from scratch".Output of `python xfit_mix.py`:
```
#obs: 10000
#iter_em: 30p1 p2 m1 m2 sd1 sd2
Guessed: 0.5000 0.5000 0.0000 0.0000 1.0000 3.0000
True: 0.3000 0.7000 0.0000 5.0000 1.0000 1.5000
Fitted: 0.3015 0.6985 0.0038 4.9650 0.9941 1.5060
Diff: 0.0015 -0.0015 0.0038 -0.0350 -0.0059 0.0060p1 p2 m1 m2 sd1 sd2
Guessed: 0.5000 0.5000 0.0000 0.0000 1.0000 3.0000
True: 0.3000 0.7000 0.0000 5.0000 1.0000 1.5000
Fitted: 0.3049 0.6951 0.0309 4.9970 0.9739 1.5032
Diff: 0.0049 -0.0049 0.0309 -0.0030 -0.0261 0.0032p1 p2 m1 m2 sd1 sd2
Guessed: 0.5000 0.5000 0.0000 0.0000 1.0000 3.0000
True: 0.3000 0.7000 0.0000 5.0000 1.0000 1.5000
Fitted: 0.2991 0.7009 -0.0105 4.9854 0.9925 1.5317
Diff: -0.0009 0.0009 -0.0105 -0.0146 -0.0075 0.0317time elapsed (s): 0.062
```