Giter Club home page Giter Club logo

gmm's Introduction

Estimate Gaussian Mixture Model (GMM) - Python Example

In this repository, I'll introduce 2 methods for Gaussian Mixture Model (GMM) estimation - EM algorithm (expectation-maximization algorithm) and variational inference (variational Bayes).
To make you have a clear picture, I'll also give you mathematical descriptions, with several lines of code in Python.

GMM formula has summation (not multiplication) in distribution, and the log likelihood will then lead to complex expression in regular maximum likelihood estimation (MLE). These 2 methods will then address this concern by procedural iterative algorithms (which approximate the optimal solutions).

EM algorithm is an iterative method based on maximum likelihood framework.
For this reason, there might have several difficulties in specific cases. For instance, when some data (observation) is same as a mean value of element in GMM, it might have a singularity, in which the likelihood goes to infinity at ฯƒ = 0. (This won't occur in a single Gaussian distribution.)
When the number of data is insufficient, this method might also over-estimate the results.

The motivation to apply variational Bayesian (variational inference) is to mitigate this kind of over-estimating and over-fitting by Bayesian approach.

Note : See here for the caveat of likelihood approach.

With Scikit-Learn package in Python, you can also use functions for both EM algorithm (sklearn.mixture.GaussianMixture) and variational Bayesian (sklearn.mixture.BayesianGaussianMixture) in GMM.
However, here I'll show you implementation from scratch in Python with mathematical explanations. By knowing mathematical background and implementation, these ideas can also be applied to other distributions - such as, mixtures of Bernoulli distributions, hidden Markov Models (HMM), etc. (See here for applying EM algorithms in HMM and LDS.)

gmm's People

Contributors

tsmatsuz avatar tsmatz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.