public class ExtractFlatClusteringFromHierarchy<D extends Distance<D>> extends Object implements ClusteringAlgorithm<Clustering<DendrogramModel<D>>>
Modifier and Type | Class and Description |
---|---|
private static class |
ExtractFlatClusteringFromHierarchy.CompareByDoubleLambda
Order a DBID collection by the lambda value.
|
private static class |
ExtractFlatClusteringFromHierarchy.CompareByLambda<D extends Distance<D>>
Order a DBID collection by the lambda value.
|
static class |
ExtractFlatClusteringFromHierarchy.OutputMode
Output mode.
|
static class |
ExtractFlatClusteringFromHierarchy.Parameterizer<D extends Distance<D>>
Parameterization class.
|
static class |
ExtractFlatClusteringFromHierarchy.ThresholdMode
Threshold mode.
|
Modifier and Type | Field and Description |
---|---|
private HierarchicalClusteringAlgorithm<D> |
algorithm
Clustering algorithm to run to obtain the hierarchy.
|
private static Logging |
LOG
Class logger.
|
private int |
minclusters
Minimum number of clusters to extract
|
private ExtractFlatClusteringFromHierarchy.OutputMode |
outputmode
Include empty cluster in the hierarchy produced.
|
private boolean |
singletons
Disallow singleton clusters, but add them to the parent cluster instead.
|
private D |
threshold
Threshold for extracting clusters.
|
Constructor and Description |
---|
ExtractFlatClusteringFromHierarchy(HierarchicalClusteringAlgorithm<D> algorithm,
D threshold,
ExtractFlatClusteringFromHierarchy.OutputMode outputmode,
boolean singletons)
Constructor.
|
ExtractFlatClusteringFromHierarchy(HierarchicalClusteringAlgorithm<D> algorithm,
int minclusters,
ExtractFlatClusteringFromHierarchy.OutputMode outputmode,
boolean singletons)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private Clustering<DendrogramModel<D>> |
extractClusters(DBIDs ids,
DBIDDataStore pi,
DataStore<D> lambda)
Extract all clusters from the pi-lambda-representation.
|
private Clustering<DendrogramModel<D>> |
extractClustersDouble(DBIDs ids,
DBIDDataStore pi,
DoubleDistanceDataStore lambda)
Extract all clusters from the pi-lambda-representation.
|
TypeInformation[] |
getInputTypeRestriction()
Get the input type restriction used for negotiating the data query.
|
private Cluster<DendrogramModel<D>> |
makeCluster(DBIDRef lead,
D depth,
DBIDs members)
Make the cluster for the given object
|
Clustering<DendrogramModel<D>> |
run(Database database)
Runs the algorithm.
|
private static final Logging LOG
private final int minclusters
private HierarchicalClusteringAlgorithm<D extends Distance<D>> algorithm
private ExtractFlatClusteringFromHierarchy.OutputMode outputmode
private boolean singletons
public ExtractFlatClusteringFromHierarchy(HierarchicalClusteringAlgorithm<D> algorithm, int minclusters, ExtractFlatClusteringFromHierarchy.OutputMode outputmode, boolean singletons)
algorithm
- Algorithm to runminclusters
- Minimum number of clustersoutputmode
- Output mode: truncated hierarchy or strict partitions.singletons
- Allow producing singleton clusters.public ExtractFlatClusteringFromHierarchy(HierarchicalClusteringAlgorithm<D> algorithm, D threshold, ExtractFlatClusteringFromHierarchy.OutputMode outputmode, boolean singletons)
algorithm
- Algorithm to runthreshold
- Distance thresholdoutputmode
- Output mode: truncated hierarchy or strict partitions.singletons
- Allow producing singleton clusters.public Clustering<DendrogramModel<D>> run(Database database)
Algorithm
run
in interface Algorithm
run
in interface ClusteringAlgorithm<Clustering<DendrogramModel<D extends Distance<D>>>>
database
- the database to run the algorithm onprivate Clustering<DendrogramModel<D>> extractClusters(DBIDs ids, DBIDDataStore pi, DataStore<D> lambda)
ids
- Object ids to processpi
- Pi storelambda
- Lambda storeprivate Clustering<DendrogramModel<D>> extractClustersDouble(DBIDs ids, DBIDDataStore pi, DoubleDistanceDataStore lambda)
ids
- Object ids to processpi
- Pi storelambda
- Lambda storeprivate Cluster<DendrogramModel<D>> makeCluster(DBIDRef lead, D depth, DBIDs members)
lead
- Leading objectdepth
- Linkage depthmembers
- Member objectspublic TypeInformation[] getInputTypeRestriction()
Algorithm
getInputTypeRestriction
in interface Algorithm