@Override public String asFormatString() { return delegate.asFormatString(); }
LOG.info("Centroid :" + (iCentroids.get(i).asFormatString()));
@Override public String asFormatString() { return delegate.asFormatString(); }
@Override public void write(Vector vector) throws IOException { writer.write(vector.asFormatString()); writer.write('\n'); }
@Override public String toString() { StringBuilder buf = new StringBuilder(); for (int x = 0; x < numTopics; x++) { String v = dictionary != null ? vectorToSortedString(topicTermCounts.viewRow(x).normalize(1), dictionary) : topicTermCounts.viewRow(x).asFormatString(); buf.append(v).append('\n'); } return buf.toString(); }
@Override public String asFormatString() { return this.getIdentifier() + ": " + this.computeCentroid().asFormatString(); }
/** * Format the cluster for output * * @param cluster * the Cluster * @return the String representation of the Cluster */ public static String formatCluster(Kluster cluster) { return cluster.getIdentifier() + ": " + cluster.computeCentroid().asFormatString(); }
@Override public String toString() { StringBuilder buf = new StringBuilder(); for (int x = 0; x < numTopics; x++) { String v = dictionary != null ? vectorToSortedString(topicTermCounts.viewRow(x).normalize(1), dictionary) : topicTermCounts.viewRow(x).asFormatString(); buf.append(v).append('\n'); } return buf.toString(); }
/** * Format the cluster for output * * @param cluster * the Cluster * @return the String representation of the Cluster */ public static String formatCluster(Kluster cluster) { return cluster.getIdentifier() + ": " + cluster.computeCentroid().asFormatString(); }
@Override public String toString() { return getIdentifier() + ": " + getCenter().asFormatString(); }
@Override public String toString() { return getIdentifier() + ": " + getCenter().asFormatString(); }
@Override public String asFormatString() { return this.getIdentifier() + ": " + this.computeCentroid().asFormatString(); }
@Override public String toString() { StringBuilder buf = new StringBuilder(); for (int x = 0; x < numTopics; x++) { String v = dictionary != null ? vectorToSortedString(topicTermCounts.viewRow(x).normalize(1), dictionary) : topicTermCounts.viewRow(x).asFormatString(); buf.append(v).append('\n'); } return buf.toString(); }
/** * Format the cluster for output * * @param cluster * the Cluster * @return the String representation of the Cluster */ public static String formatCluster(Kluster cluster) { return cluster.getIdentifier() + ": " + cluster.computeCentroid().asFormatString(); }
private void assertFirstClusterWithoutOutlierRemoval() { Assert.assertEquals(3, firstCluster.size()); for (Vector vector : firstCluster) { Assert.assertTrue(ArrayUtils.contains(new String[] {"{0:1.0,1:1.0}", "{0:2.0,1:1.0}", "{0:1.0,1:2.0}"}, vector.asFormatString())); } }
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()); } } }
private void assertThirdClusterWithoutOutlierRemoval() { Assert.assertEquals(2, thirdCluster.size()); for (Vector vector : thirdCluster) { Assert.assertTrue(ArrayUtils.contains(new String[] {"{0:9.0,1:9.0}", "{0:8.0,1:8.0}"}, vector.asFormatString())); } }
private void assertSecondClusterWithoutOutlierRemoval() { Assert.assertEquals(4, secondCluster.size()); for (Vector vector : secondCluster) { Assert.assertTrue(ArrayUtils.contains(new String[] {"{0:4.0,1:4.0}", "{0:5.0,1:4.0}", "{0:4.0,1:5.0}", "{0:5.0,1:5.0}"}, vector.asFormatString())); } }
private void assertPointsInFirstTopLevelCluster(Path clusterPath) throws IOException { List<Vector> vectorsInCluster = getVectorsInCluster(clusterPath); for (Vector vector : vectorsInCluster) { Assert.assertTrue(ArrayUtils.contains(new String[] {"{0:1.0,1:1.0}", "{0:2.0,1:1.0}", "{0:1.0,1:2.0}"}, vector.asFormatString())); } }
private void assertPointsInSecondTopLevelCluster(Path clusterPath) throws IOException { List<Vector> vectorsInCluster = getVectorsInCluster(clusterPath); for (Vector vector : vectorsInCluster) { Assert.assertTrue(ArrayUtils.contains(new String[] {"{0:4.0,1:4.0}", "{0:5.0,1:4.0}", "{0:4.0,1:5.0}", "{0:5.0,1:5.0}"}, vector.asFormatString())); } }