- java.lang.Object
-
- elki.data.Clustering<M>
-
- Type Parameters:
M
- Model type
- Direct Known Subclasses:
ReferenceClustering
public class Clustering<M extends Model> extends java.lang.Object
Result class for clusterings. Can be used for both hierarchical and non-hierarchical clusterings. The class does not enforce or rely on clusterings to be a tree or DAG, instead they can be an arbitrary forest of directed graphs that COULD contain cycles. This class is NOT iterable for a simple reason: there is more than one method to do so. You need to specify whether you want to use getToplevelClusters() or getAllClusters().- Since:
- 0.2
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description private ModifiableHierarchy<Cluster<M>>
hierarchy
Cluster hierarchy.private java.util.List<Cluster<M>>
toplevelclusters
Keep a list of top level clusters.static SimpleTypeInformation<Clustering<?>>
TYPE
Type information, for relation matching.
-
Constructor Summary
Constructors Constructor Description Clustering()
Constructor for an empty clusteringClustering(java.util.List<Cluster<M>> toplevelclusters)
Constructor with a list of top level clusters
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChildCluster(Cluster<M> parent, Cluster<M> child)
Add a cluster to the clustering.void
addToplevelCluster(Cluster<M> clus)
Add a cluster to the clustering.java.util.List<Cluster<M>>
getAllClusters()
Collect all clusters (recursively) into a List.Hierarchy<Cluster<M>>
getClusterHierarchy()
Get the cluster hierarchy.static java.util.List<Clustering<? extends Model>>
getClusteringResults(java.lang.Object r)
Collect all clustering results from a Resultjava.util.List<Cluster<M>>
getToplevelClusters()
Return top level clustersIt<Cluster<M>>
iterToplevelClusters()
Iterate over the top level clusters.
-
-
-
Field Detail
-
TYPE
public static final SimpleTypeInformation<Clustering<?>> TYPE
Type information, for relation matching.
-
toplevelclusters
private java.util.List<Cluster<M extends Model>> toplevelclusters
Keep a list of top level clusters.
-
hierarchy
private ModifiableHierarchy<Cluster<M extends Model>> hierarchy
Cluster hierarchy.
-
-
Method Detail
-
addToplevelCluster
public void addToplevelCluster(Cluster<M> clus)
Add a cluster to the clustering.- Parameters:
clus
- new cluster
-
addChildCluster
public void addChildCluster(Cluster<M> parent, Cluster<M> child)
Add a cluster to the clustering.- Parameters:
parent
- Parent clusterchild
- Child cluster.
-
getToplevelClusters
public java.util.List<Cluster<M>> getToplevelClusters()
Return top level clusters- Returns:
- top level clusters
-
getClusterHierarchy
public Hierarchy<Cluster<M>> getClusterHierarchy()
Get the cluster hierarchy.- Returns:
- Cluster hierarchy.
-
getAllClusters
public java.util.List<Cluster<M>> getAllClusters()
Collect all clusters (recursively) into a List.- Returns:
- List of all clusters.
-
iterToplevelClusters
public It<Cluster<M>> iterToplevelClusters()
Iterate over the top level clusters.- Returns:
- Iterator
-
getClusteringResults
public static java.util.List<Clustering<? extends Model>> getClusteringResults(java.lang.Object r)
Collect all clustering results from a Result- Parameters:
r
- Result- Returns:
- List of clustering results
-
-