anl.aida.algo
Class ClustersBuilder<T>

java.lang.Object
  extended by anl.aida.algo.ClustersBuilder<T>

public class ClustersBuilder<T>
extends java.lang.Object

Builder for clusters.


Nested Class Summary
private static class ClustersBuilder.DefClusters<T>
           
 
Field Summary
private  java.util.List<SimilarityCluster<T>> clusters
           
private  java.util.Map<T,float[]> itemScores
           
 
Constructor Summary
ClustersBuilder()
           
 
Method Summary
 void addCluster(float[] vals, java.lang.String... labels)
           
private  void addItemScore(T item, int cluster, float score)
           
 void addItemToCluster(T item, int clusterIndex, double[] itemVector)
          Adds an item to the specified cluster.
 void addItemToCluster(T item, int clusterIndex, float score)
          Adds an item to the specified cluster.
 Clusters<T> buildClusters()
          Builds a Clusters instance out of the data that has been added between any calls to buildCluster.
 int clusterCount()
           
 void itemScore(T item, int clusterIndex, double[] itemVector)
          Calculates the specified items similarity score for the specified cluster.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clusters

private java.util.List<SimilarityCluster<T>> clusters

itemScores

private java.util.Map<T,float[]> itemScores
Constructor Detail

ClustersBuilder

public ClustersBuilder()
Method Detail

addCluster

public void addCluster(float[] vals,
                       java.lang.String... labels)

addItemToCluster

public void addItemToCluster(T item,
                             int clusterIndex,
                             double[] itemVector)
Adds an item to the specified cluster. The items similarity with that cluster will be calculated using the itemVector and the cluster's centroid.

Parameters:
item - the item to add
clusterIndex - the index of the cluster to add the item to
itemVector - the item's vector

addItemToCluster

public void addItemToCluster(T item,
                             int clusterIndex,
                             float score)
Adds an item to the specified cluster. The items similarity with that cluster will be calculated using the itemVector and the cluster's centroid.

Parameters:
item - the item to add
clusterIndex - the index of the cluster to add the item to
score - the item's score

clusterCount

public int clusterCount()

itemScore

public void itemScore(T item,
                      int clusterIndex,
                      double[] itemVector)
Calculates the specified items similarity score for the specified cluster.

Parameters:
item - the item to add
clusterIndex - the index of the cluster to add the item to
itemVector - the item's vector

addItemScore

private void addItemScore(T item,
                          int cluster,
                          float score)

buildClusters

public Clusters<T> buildClusters()
Builds a Clusters instance out of the data that has been added between any calls to buildCluster.

Returns:
the built Clusters instance