anl.aida.algo
Class ClustersBuilder<T>
java.lang.Object
anl.aida.algo.ClustersBuilder<T>
public class ClustersBuilder<T>
- extends java.lang.Object
Builder for clusters.
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 |
clusters
private java.util.List<SimilarityCluster<T>> clusters
itemScores
private java.util.Map<T,float[]> itemScores
ClustersBuilder
public ClustersBuilder()
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 addclusterIndex
- the index of the cluster to add the item toitemVector
- 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 addclusterIndex
- the index of the cluster to add the item toscore
- 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 addclusterIndex
- the index of the cluster to add the item toitemVector
- 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