New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

expectation-maximization

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expectation-maximization

Fit multivariate data with a gaussian mixture model using the EM algorithm.

  • 1.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

expectation-maximization

Build Status

Expectation–maximization (EM) algorithm for n-dimensional vectors, implemented in javascript. This allows to fit points with a multivariate gaussian mixture model.

This can be used for statistical classification of multivariate data, anomaly detection, or predictive analytics.

Goal

You have n-dimensional datapoints that belong to k groups. With this algorithm, you can detect not only which point belongs to which group, but also what the features of each group (mean, covariance) are.

The algorithm works by repetitively estimating the probability of each point to belong to each group, and maximizing the parameters of the groups so that they best fit the data. Detailed description of the algorithm on wikipedia

Visualization of the consecutive steps of the algorithm. Image from Wikipedia

How to use

var expectation_maximization = require('expectation-maximization');

// n-dimensional data points are stored as a simple array of array
var points = [
 [1,2], [3,4], [5,6]
];

var n_groups = 2; // We clusterize our data into two groups
var groups = expectation_maximization(points, n_groups);

////// result:
[
 {
   weight: .5, // weight (a-priori probabibility) of the group
   mu: [2, 3], // mean vector of the group
   sigma: [[1,0],[0,1]] // covariance matrix of the group
 },
 ... // other groups
]

Documentation

Auto-generated jsdoc documentation is available here

Demo

A basic demo is availaible here: https://lovasoa.github.io/expectation-maximization/dist/

Keywords

FAQs

Package last updated on 20 Dec 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