Examples of ChineseRestaurant


Examples of org.apache.mahout.math.random.ChineseRestaurant

   * @param alpha       Controls the growth of the number of clusters.  The number of clusters will be about alpha * log(samples)
   */
  public LumpyData(int dimension, double radius, double alpha) {
    this.centers = new MultiNormal(dimension);
    this.radius = radius;
    cluster = new ChineseRestaurant(alpha);
  }
View Full Code Here

Examples of org.apache.mahout.math.random.ChineseRestaurant

        Client client = new Client(Collections.singleton(new PeerInfo(options.host, options.port)));

        History recorder = new History(1, 10, 30).logTicks();

        Random gen = RandomUtils.getRandom();
        ChineseRestaurant topicSampler = new ChineseRestaurant(options.alpha);
        Exponential interval = new Exponential(1, gen);
        double t = 0;
        long t0 = System.nanoTime();
        long messageId = 0;
        while (messageId < options.max) {
            double rate = options.peak * Math.exp(-scale * (Math.cos(2 * Math.PI * t / options.period) + 1));
            double dt = interval.nextDouble() / rate;
            t += dt;
            double now = (System.nanoTime() - t0) / 1e9;
            if (t > now + 0.01) {
                double millis = Math.floor((t - now) * 1000);
                double nanos = Math.rint((t - now) * 1e9 - millis * 1e6);
                Thread.sleep((long) millis, (int) nanos);
            }

            String topic = "topic-" + topicSampler.sample();
            String message = "m-" + (++messageId);
            client.sendMessage(topic, message);
            recorder.message(topic);
            log.debug("Sent {} / {}", topic, message);
            if ((messageId % 10000) == 0) {
View Full Code Here

Examples of org.apache.mahout.math.random.ChineseRestaurant

   * @param alpha       Controls the growth of the number of clusters.  The number of clusters will be about alpha * log(samples)
   */
  public LumpyData(int dimension, double radius, double alpha) {
    this.centers = new MultiNormal(dimension);
    this.radius = radius;
    cluster = new ChineseRestaurant(alpha);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.