Examples of MeanShiftCanopy


Examples of org.apache.mahout.clustering.meanshift.MeanShiftCanopy

  }

  public void testMSCanopyAsFormatString() {
    double[] d = { 1.1, 2.2, 3.3 };
    Vector m = new DenseVector(d);
    Printable cluster = new MeanShiftCanopy(m, 123);
    String formatString = cluster.asFormatString(null);
    System.out.println(formatString);
    assertEquals("format", "C123: [1.100, 2.200, 3.300]", formatString);
  }
View Full Code Here

Examples of org.apache.mahout.clustering.meanshift.MeanShiftCanopy

  public void testMSCanopyAsFormatStringSparse() {
    double[] d = { 1.1, 0.0, 3.3 };
    Vector m = new SequentialAccessSparseVector(3);
    m.assign(d);
    Printable cluster = new MeanShiftCanopy(m, 123);
    String formatString = cluster.asFormatString(null);
    System.out.println(formatString);
    assertEquals("format", "C123: [0:1.100, 2:3.300]", formatString);
  }
View Full Code Here

Examples of org.apache.mahout.clustering.meanshift.MeanShiftCanopy

  }

  public void testMSCanopyAsFormatStringWithBindings() {
    double[] d = { 1.1, 2.2, 3.3 };
    Vector m = new DenseVector(d);
    Printable cluster = new MeanShiftCanopy(m, 123);
    String[] bindings = { "fee", null, "foo" };
    String formatString = cluster.asFormatString(bindings);
    System.out.println(formatString);
    assertEquals("format", "C123: [fee:1.100, 1:2.200, foo:3.300]", formatString);
  }
View Full Code Here

Examples of org.apache.mahout.clustering.meanshift.MeanShiftCanopy

  public void testMSCanopyAsFormatStringSparseWithBindings() {
    double[] d = { 1.1, 0.0, 3.3 };
    Vector m = new SequentialAccessSparseVector(3);
    m.assign(d);
    Printable cluster = new MeanShiftCanopy(m, 123);
    String[] bindings = { "fee", null, "foo" };
    String formatString = cluster.asFormatString(bindings);
    System.out.println(formatString);
    assertEquals("format", "C123: [fee:1.100, foo:3.300]", formatString);
  }
View Full Code Here

Examples of org.apache.mahout.clustering.meanshift.MeanShiftCanopy

    Vector point = new DenseVector(doubles.size());
    int index = 0;
    for (Double d : doubles) {
      point.set(index++, d);
    }
    MeanShiftCanopy canopy = new MeanShiftCanopy(point, nextCanopyId++);
    output.collect(new Text(), canopy);
  }
View Full Code Here

Examples of org.apache.mahout.clustering.meanshift.MeanShiftCanopy

    }
   
  }
 
  protected void dump(SequenceFile.Reader reader, PrintWriter writer) throws IOException{
    MeanShiftCanopy value = new MeanShiftCanopy();
    Text key = new Text();
    while(reader.next(key, value)){
      if(key != null && value != null){
        writer.println("key: " + key.toString());
        writer.println("value: " + value.getCenter().getName());
      }
    }
  }
View Full Code Here

Examples of org.apache.mahout.clustering.meanshift.MeanShiftCanopy

  @Test
  public void testMSCanopyAsFormatString() {
    double[] d = { 1.1, 2.2, 3.3 };
    Vector m = new DenseVector(d);
    Cluster cluster = new MeanShiftCanopy(m, 123, measure);
    String formatString = cluster.asFormatString(null);
    System.out.println(formatString);
    assertEquals("format", "MSC-123{n=0 c=[1.100, 2.200, 3.300] r=[]}", formatString);
  }
View Full Code Here

Examples of org.apache.mahout.clustering.meanshift.MeanShiftCanopy

  @Test
  public void testMSCanopyClassification() {
    List<Model<VectorWritable>> models = new ArrayList<Model<VectorWritable>>();
    DistanceMeasure measure = new ManhattanDistanceMeasure();
    models.add(new MeanShiftCanopy(new DenseVector(2).assign(1), 0, measure));
    models.add(new MeanShiftCanopy(new DenseVector(2), 1, measure));
    models.add(new MeanShiftCanopy(new DenseVector(2).assign(-1), 2, measure));
    AbstractVectorClassifier classifier = new VectorModelClassifier(models);
    try {
      classifier.classify(new DenseVector(2));
      fail("Expected NotImplementedException");
    } catch (NotImplementedException e) {
View Full Code Here

Examples of org.apache.mahout.clustering.meanshift.MeanShiftCanopy

  @Test
  public void testMSCanopyAsFormatStringSparse() {
    double[] d = { 1.1, 0.0, 3.3 };
    Vector m = new SequentialAccessSparseVector(3);
    m.assign(d);
    Cluster cluster = new MeanShiftCanopy(m, 123, measure);
    String formatString = cluster.asFormatString(null);
    System.out.println(formatString);
    assertEquals("format", "MSC-123{n=0 c=[0:1.100, 2:3.300] r=[]}", formatString);
  }
View Full Code Here

Examples of org.apache.mahout.clustering.meanshift.MeanShiftCanopy

  @Test
  public void testMSCanopyAsFormatStringWithBindings() {
    double[] d = { 1.1, 2.2, 3.3 };
    Vector m = new DenseVector(d);
    Cluster cluster = new MeanShiftCanopy(m, 123, measure);
    String[] bindings = { "fee", null, "foo" };
    String formatString = cluster.asFormatString(bindings);
    System.out.println(formatString);
    assertEquals("format", "MSC-123{n=0 c=[fee:1.100, 1:2.200, foo:3.300] r=[]}", formatString);
  }
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.