gaussian-fit

Fit data with gaussian mixture by EM algorithm

Stats

StarsIssuesVersionUpdatedCreatedSize
gaussian-fit
401.0.05 years ago5 years agoMinified + gzip package size for gaussian-fit in KB

Readme

gaussian-fit unstable

Fit time/spectrum/other sequential data with a set of gaussians by expectation-maximization algoritm.

gaussian-fit

Usage

npm install gaussian-fit

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}
    //if null - the components will be detected automatically
    components: null,

    //max number of components in case of auto-detection
    maxNumber: 100,

    //max number of iterations
    maxIterations: 200,

    //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
})

fit(data, components?)

Also see webgl version gaussian-fit/gl for better performance.

Similar

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.