https://github.com/dy/gaussian-fit
Fit mixture of gaussians into data
https://github.com/dy/gaussian-fit
Last synced: 8 months ago
JSON representation
Fit mixture of gaussians into data
- Host: GitHub
- URL: https://github.com/dy/gaussian-fit
- Owner: dy
- Created: 2016-11-13T09:08:00.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-12-02T19:23:08.000Z (over 5 years ago)
- Last Synced: 2025-09-12T21:16:13.169Z (9 months ago)
- Language: JavaScript
- Homepage: https://formant.github.io/gaussian-fit/
- Size: 74.2 KB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# gaussian-fit [](http://github.com/badges/stability-badges)
Fit time/spectrum/other sequential data with a set of gaussians by [expectation-maximization](https://en.wikipedia.org/wiki/Expectation%E2%80%93maximization_algorithm) algoritm.
[](http://dfcreative.github.io/gaussian-fit/)
## Usage
[](https://npmjs.org/package/gaussian-fit/)
```js
const fit = require('gaussian-fit')
// time/frequency/etc series
let data = [0, .1, .2, .5, .2, .1, 0]
let how = {
// predefined components, each one is object {weight, mean, variance}
// TODO if null - the components will be detected automatically
components: null,
// TODO max number of components in case of auto-detection
maxNumber: 100,
// max number of iterations
maxIterations: 200,
// TODO min difference of likelihood
tolerance: 1e-5,
}
let components = fit(data, how)
components.forEach({weight, mean, variance} => {
// every component is an object with weight, mean and variance properties
})
```
## Similar
* [gaussianmixture](https://www.npmjs.com/package/gaussianMixture) — classical gaussian mixture for 1d samples
* [gaussian-mixture-estimator](https://github.com/rreusser/gaussian-mixture-estimator) — nd samples data estimation