@Override public String getIdentifier() { return "C-" + getId(); } }
@Override public String getIdentifier() { return "C-" + getId(); } }
@Override public String getIdentifier() { return "C-" + getId(); } }
public String asFormatString() { return "C" + this.getId() + ": " + this.computeCentroid().asFormatString(); }
public String asFormatString() { return "C" + this.getId() + ": " + this.computeCentroid().asFormatString(); }
public String asFormatString() { return "C" + this.getId() + ": " + this.computeCentroid().asFormatString(); }
clusters.add(new Kluster(canopy.getCenter(), canopy.getId(), canopy.getMeasure())); } else { throw new IllegalStateException("Bad value class: " + valueClass);
clusters.add(new Kluster(canopy.getCenter(), canopy.getId(), canopy.getMeasure())); } else { throw new IllegalStateException("Bad value class: " + valueClass);
public static void main(String args[]) throws Exception { String inputDir = "reuters"; Configuration conf = new Configuration(); FileSystem fs = FileSystem.get(conf); String vectorsFolder = inputDir + "/tfidf-vectors"; SequenceFile.Reader reader = new SequenceFile.Reader(fs, new Path(vectorsFolder + "/part-r-00000"), conf); List<Vector> points = new ArrayList<Vector>(); Text key = new Text(); VectorWritable value = new VectorWritable(); while (reader.next(key, value)) { points.add(value.get()); } System.out.println(points.size()); reader.close(); List<Canopy> canopies = CanopyClusterer.createCanopies(points, new CosineDistanceMeasure(), 0.8, 0.7); List<Cluster> clusters = new ArrayList<Cluster>(); System.out.println(canopies.size()); for (Canopy canopy : canopies) { clusters.add(new Cluster(canopy.getCenter(), canopy.getId(), new CosineDistanceMeasure())); } } }
clusters.add(new Kluster(canopy.getCenter(), canopy.getId(), canopy.getMeasure())); } else { throw new IllegalStateException("Bad value class: " + valueClass);
public static void main(String[] args) { List<Vector> sampleData = new ArrayList<Vector>(); RandomPointsUtil.generateSamples(sampleData, 400, 1, 1, 2); RandomPointsUtil.generateSamples(sampleData, 300, 1, 0, 0.5); RandomPointsUtil.generateSamples(sampleData, 300, 0, 2, 0.1); List<Canopy> canopies = CanopyClusterer.createCanopies(sampleData, new EuclideanDistanceMeasure(), 3.0, 1.5); for (Canopy canopy : canopies) { System.out.println("Canopy id: " + canopy.getId() + " center: " + canopy.getCenter().asFormatString()); } } }
System.out.println(canopies.size()); for (Canopy canopy : canopies) { clusters.add(new Cluster(canopy.getCenter(), canopy.getId(), new CosineDistanceMeasure()));
clusters.add(new SoftCluster(canopy.getCenter(), canopy.getId(), canopy.getMeasure())); } else { throw new IllegalStateException("Bad value class: " + valueClass);
clusters.add(new SoftCluster(canopy.getCenter(), canopy.getId(), canopy.getMeasure())); } else { throw new IllegalStateException("Bad value class: " + valueClass);
clusters.add(new SoftCluster(canopy.getCenter(), canopy.getId(), canopy.getMeasure())); } else { throw new IllegalStateException("Bad value class: " + valueClass);