4

How can I write a GMM (Gaussian mixture model) in Java? There are some implementations in MATLAB, but I am looking for some documentation about it and example code in Java.

PS: If it is possible, how can I adopt the Weka implementation in my code?

PS 2: I found http://www.lix.polytechnique.fr/~nielsen/MEF/ Where is the source code of GMM inside it so I can adopt it at my code?

PS 3: Other code found is: http://www.dii.unisi.it/~freno/JProGraM.html, but it still has the problem how to adopt it. I should give the List of my input and get all the classified elements list from the algorithm.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
kamaci
  • 72,915
  • 69
  • 228
  • 366
  • Both links are (effectively) broken (the first's manual GitHub links (two identical URLs) redirect lead to a 404 and the second leads to *"Forbidden. You don't have permission to access this resource."*) – Peter Mortensen Oct 13 '21 at 00:46

3 Answers3

5

Weka is Java data mining software that can do GMMs. It also has a nice GUI where you can do some preliminary modeling before doing everything in Java.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
jberg
  • 4,758
  • 2
  • 20
  • 15
  • 1
    You can download source jars of WEKA and use the different models in your own code :) – jberg Jun 02 '11 at 20:29
  • Could you find a link to package of GMM Weka? – kamaci Jun 02 '11 at 20:31
  • You want to use EM to generate a GMM so: http://weka.sourceforge.net/doc/weka/clusterers/EM.html – jberg Jun 02 '11 at 20:37
  • Here's an example to get you started: http://weka.wikispaces.com/Programmatic+Use . Note that FastVector is now deprecated, so for this example you would rather use java.util.ArrayList. Furthermore, since Instance is now an interface, you must instantiate using some implementing class like DenseInstance or SparseInstance. That example needs an update :p – Håvard Geithus May 08 '13 at 15:43
3

I'm the author of jMEF :) jMEF will allow you to create, process and manage mixtures of exponential families including of course GMMs. You basically have to create a mixture model based on the Gaussian distribution. I've written a bunch of tutorials to help understanding how to use it properly. It's pretty straightforward. The good thing is that you can estimate your mixture from samples using the EM algorithm.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Garcia
  • 31
  • 1
0

You can use "MATLAB Builder JA" to get ".JAR" file and source code from your "implementations in MATLAB". Like that, you can incorporate the result into your Java application.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Adil
  • 5
  • 3