mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sven Boekhoff <>
Subject Creating Multinomial Random numbers with Mahout
Date Fri, 04 Sep 2009 12:04:36 GMT

I like to use the Mahout-Library to create multinomial random numbers 
(strangely there is no other library available, as far as I know). I 
tried several things, but nothing worked, and the documentation was not 
very helpful for me (maybe because I'm a Java newbie). My last 
sourcecode was:

//import java.util.Random;
//import java.util.Vector;

import org.apache.mahout.clustering.dirichlet.UncommonDistributions;
import org.apache.mahout.matrix.Vector;

public class Main {

     public static void main(String[] args) {


         Vector probabilities = new Vector();
         Vector<Float> probabilities = new Vector<Float>();
         probabilities.add((float) 0.1);
         probabilities.add((float) 0.2);
         probabilities.add((float) 0.3);
         probabilities.add((float) 0.4);

         // 100 Messpunkte
         for(int i=0; i<100; i++) {

             UncommonDistributions dist = (UncommonDistributions) new 
             // UncommonDistributions dist = new UncommonDistributions();

             Vector newCoordinates = dist.rMultinom(100, probabilities);




I hope somebody can tell me how to use the library in a correct way. I'm 
also searching for a library to create (multi-)HyperGeometric random 

Thanks in advance,


View raw message