return buf.toString();
}
private void printClusters(List<Cluster> models, String[] docs) {
for (int m = 0; m < models.size(); m++) {
Cluster model = models.get(m);
long total = model.getTotalObservations();
if (total == 0) {
continue;
}
System.out.println();
System.out.println("Model[" + m + "] had " + total + " observations");
System.out.println("pdf document");
MapElement[] map = new MapElement[sampleData.size()];
// sort the samples by pdf
double maxPdf = Double.MIN_NORMAL;
for (int i = 0; i < sampleData.size(); i++) {
VectorWritable sample = new VectorWritable(sampleData.get(i));
double pdf = Math.abs(model.pdf(sample));
maxPdf = Math.max(maxPdf, pdf);
map[i] = new MapElement(pdf, docs[i]);
}
Arrays.sort(map);
for (MapElement aMap : map) {