Examples of Kmeans


Examples of com.github.pmerienne.trident.ml.clustering.KMeans

public class KMeansTest extends ClustererTest {

  @Test
  public void testAgainstGaussianInstances() {
    int nbCluster = 5;
    KMeans kMeans = new KMeans(nbCluster);
    List<Instance<Integer>> samples = Datasets.generateDataForClusterization(nbCluster, 5000);

    double randIndex = this.eval(kMeans, samples);
    assertTrue("RAND index " + randIndex + "  isn't good enough : ", randIndex > 0.80);
  }
View Full Code Here

Examples of com.github.pmerienne.trident.ml.clustering.KMeans

    assertTrue("RAND index " + randIndex + "  isn't good enough : ", randIndex > 0.80);
  }

  @Test
  public void testAgainstRealDataset() {
    KMeans kMeans = new KMeans(7);
    double randIndex = this.eval(kMeans, Datasets.getClusteringSamples());
    assertTrue("RAND index " + randIndex + "  isn't good enough : ", randIndex > 0.70);
  }
View Full Code Here

Examples of com.github.pmerienne.trident.ml.clustering.KMeans

        // Convert trident tuple to instance
        .each(new Fields("label", "x0", "x1", "x2"), new InstanceCreator<Integer>(), new Fields("instance"))

        // Update a 3 classes kmeans
        .partitionPersist(new MemoryMapState.Factory(), new Fields("instance"), new ClusterUpdater("kmeans", new KMeans(3)));

      // Cluster stream
      toppology.newDRPCStream("predict", localDRPC)
        // Convert DRPC args to instance
        .each(new Fields("args"), new DRPCArgsToInstance(), new Fields("instance"))
View Full Code Here

Examples of com.heatonresearch.aifh.kmeans.KMeans

            }

            final DataSet ds = DataSet.load(istream);
            istream.close();
            final List<BasicData> observations = ds.extractUnsupervisedLabeled(4);
            final KMeans kmeans = new KMeans(3);
            kmeans.initForgy(observations);
            final int iterations = kmeans.iteration(1000);
            System.out.println("Finished after " + iterations + " iterations.");

            for (int i = 0; i < kmeans.getK(); i++) {
                final Cluster cluster = kmeans.getClusters().get(i);
                System.out.println("* * * Cluster #" + i);
                for (final BasicData d : cluster.getObservations()) {
                    System.out.println(d.toString());
                }
            }
View Full Code Here

Examples of com.nr.ci.Kmeans

        x[k][1]=means[i][1]+d0*vec1[i][1]+d1*vec2[i][1];
        k++;
      }
    }

    Kmeans kmean=new Kmeans(x,guess)// *** put in some weird guesses

    for (i=0;i<100;i++) {
      flag=kmean.estep();
      if (flag == 0) break;
      kmean.mstep();
    }

    // check for convergence
//    System.out.println("  flag: %f\n", flag);
    localflag = flag > 0;
View Full Code Here

Examples of com.sketchingbits.mlearning.clustering.KMeans

      {1.0, 1.0, 0.0, 1.0, 1.0, 0.0},
      {1.0, 1.0, 0.0, 1.0, 1.0, 0.0},
      {1.0, 1.0, 0.0, 1.0, 1.0, 0.0},
    };
   
    KMeans kMeansAnalysis = new KMeans(dataset);
    kMeansAnalysis.run();
    //Assert.
   
  }
View Full Code Here

Examples of eu.stratosphere.examples.scala.datamining.KMeans

  }
 

  @Override
  protected Plan getTestJob() {
    KMeans kmi = new KMeans();
    return kmi.getScalaPlan(4, pointsPath, clusterPath, resultPath, 20);
  }
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.