Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gaussianMixture

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gaussianMixture

An implementation of a Gaussian Mixture class in one dimension, that allows to fit models with an Expectation Maximization algorithm.

  • 0.5.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12
increased by500%
Maintainers
1
Weekly downloads
 
Created
Source

Gaussian Mixture

Build Status

This module implements a 1D Gaussian Mixture class that allows to fit a distribution of points along a one dimensional axis.

Usage

var GMM = require('gaussianMixture')

var nComponents = 3
var weights = [0.3, 0.2, 0.5]
var means = [1, 7, 15]
var vars = [1, 2, 1]

var gmm = new GMM(nComponents, weights, means, vars)
gmm.sample(10)  // return 10 datapoints from the mixture

data = [1.2, 1.3, 7.4, 1.4, 14.3, 15.3, 1.0, 7.2]
gmm.optimize(data) // updates weights, means and variances with the EM algorithm given the data.
console.log(gmm.means); // >> [1.225, 7.3, 14.8]

Options

Optionally, define an options object and pass it at instantiation:

var options = {
  variancePrior: // Float,
  separationPrior: // Float,
  priorRelevance: // Positive float.
};

var gmm = new GMM(nComponents, weights, means, vars, options);

The variance prior allows you to define a prior for the variance of all components (assumed the same). This prior will be mixed in the maximization step of the EM optimization with a relevance score equal to options.priorRelevance.

Similarly, the separation prior allows you to define a prior for the difference between consecutive gaussian mixture means. This prior is mixed with the sale options.priorRelevance score.

The mixing weight alpha for component i is alpha = weights[i] / (weights[i] + options.priorRelevance).

Keywords

FAQs

Package last updated on 31 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc