Package elki.algorithm.statistics
Class DistanceStatisticsWithClasses<O>
- java.lang.Object
-
- elki.algorithm.statistics.DistanceStatisticsWithClasses<O>
-
- Type Parameters:
O- Object type
- All Implemented Interfaces:
Algorithm
@Title("Distance Histogram") @Description("Computes a histogram over the distances occurring in the data set.") public class DistanceStatisticsWithClasses<O> extends java.lang.Object implements Algorithm
Algorithm to gather statistics over the distance distribution in the data set.- Since:
- 0.2
- Author:
- Erich Schubert
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface elki.Algorithm
Algorithm.Utils
-
-
Field Summary
Fields Modifier and Type Field Description protected Distance<? super O>distanceDistance function used.protected booleanexactCompute exactly (slower).private static LoggingLOGThe logger for this class.protected intnumbinNumber of bins to use in sampling.protected booleansamplingSampling flag.
-
Constructor Summary
Constructors Constructor Description DistanceStatisticsWithClasses(Distance<? super O> distance, int numbins, boolean exact, boolean sampling)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private DoubleMinMaxexactMinMax(Relation<O> relation, DistanceQuery<O> distance)Compute the exact maximum and minimum.TypeInformation[]getInputTypeRestriction()Get the input type restriction used for negotiating the data query.HistogramResultrun(Database database, Relation<O> relation)private DoubleMinMaxsampleMinMax(Relation<O> relation, DistanceQuery<O> distance)Estimate minimum and maximum via sampling.private static voidshrinkHeap(java.util.TreeSet<DoubleDBIDPair> hotset, int k)Shrink the heap of "hot" (extreme) items.
-
-
-
Field Detail
-
LOG
private static final Logging LOG
The logger for this class.
-
numbin
protected int numbin
Number of bins to use in sampling.
-
sampling
protected boolean sampling
Sampling flag.
-
exact
protected boolean exact
Compute exactly (slower).
-
-
Method Detail
-
getInputTypeRestriction
public TypeInformation[] getInputTypeRestriction()
Description copied from interface:AlgorithmGet the input type restriction used for negotiating the data query.- Specified by:
getInputTypeRestrictionin interfaceAlgorithm- Returns:
- Type restriction
-
run
public HistogramResult run(Database database, Relation<O> relation)
-
sampleMinMax
private DoubleMinMax sampleMinMax(Relation<O> relation, DistanceQuery<O> distance)
Estimate minimum and maximum via sampling.- Parameters:
relation- Relation to processdistance- Distance function to use- Returns:
- Minimum and maximum
-
exactMinMax
private DoubleMinMax exactMinMax(Relation<O> relation, DistanceQuery<O> distance)
Compute the exact maximum and minimum.- Parameters:
relation- Relation to processdistance- Distance function- Returns:
- Exact maximum and minimum
-
shrinkHeap
private static void shrinkHeap(java.util.TreeSet<DoubleDBIDPair> hotset, int k)
Shrink the heap of "hot" (extreme) items.- Parameters:
hotset- Set of hot itemsk- target size
-
-