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>
distance
Distance function used.protected boolean
exact
Compute exactly (slower).private static Logging
LOG
The logger for this class.protected int
numbin
Number of bins to use in sampling.protected boolean
sampling
Sampling 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 DoubleMinMax
exactMinMax(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.HistogramResult
run(Database database, Relation<O> relation)
private DoubleMinMax
sampleMinMax(Relation<O> relation, DistanceQuery<O> distance)
Estimate minimum and maximum via sampling.private static void
shrinkHeap(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:Algorithm
Get the input type restriction used for negotiating the data query.- Specified by:
getInputTypeRestriction
in 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
-
-