O
- Object type@Title(value="Distance Histogram") @Description(value="Computes a histogram over the distances occurring in the data set.") public class DistanceStatisticsWithClasses<O> extends AbstractDistanceBasedAlgorithm<O,CollectionResult<double[]>>
Modifier and Type | Class and Description |
---|---|
static class |
DistanceStatisticsWithClasses.Parameterizer<O>
Parameterization class.
|
Modifier and Type | Field and Description |
---|---|
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.
|
ALGORITHM_ID
DISTANCE_FUNCTION_ID
Constructor and Description |
---|
DistanceStatisticsWithClasses(DistanceFunction<? super O> distanceFunction,
int numbins,
boolean exact,
boolean sampling)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private DoubleMinMax |
exactMinMax(Relation<O> relation,
DistanceQuery<O> distFunc)
Compute the exact maximum and minimum.
|
TypeInformation[] |
getInputTypeRestriction()
Get the input type restriction used for negotiating the data query.
|
protected Logging |
getLogger()
Get the (STATIC) logger for this class.
|
HistogramResult |
run(Database database)
Runs the algorithm.
|
private DoubleMinMax |
sampleMinMax(Relation<O> relation,
DistanceQuery<O> distFunc)
Estimate minimum and maximum via sampling.
|
private static void |
shrinkHeap(java.util.TreeSet<DoubleDBIDPair> hotset,
int k)
Shrink the heap of "hot" (extreme) items.
|
getDistanceFunction
private static final Logging LOG
protected int numbin
protected boolean sampling
protected boolean exact
public DistanceStatisticsWithClasses(DistanceFunction<? super O> distanceFunction, int numbins, boolean exact, boolean sampling)
distanceFunction
- Distance function to usenumbins
- Number of binsexact
- Exactness flagsampling
- Sampling flagpublic HistogramResult run(Database database)
Algorithm
run
in interface Algorithm
run
in class AbstractAlgorithm<CollectionResult<double[]>>
database
- the database to run the algorithm onprivate DoubleMinMax sampleMinMax(Relation<O> relation, DistanceQuery<O> distFunc)
relation
- Relation to processdistFunc
- Distance function to useprivate DoubleMinMax exactMinMax(Relation<O> relation, DistanceQuery<O> distFunc)
relation
- Relation to processdistFunc
- Distance functionprivate static void shrinkHeap(java.util.TreeSet<DoubleDBIDPair> hotset, int k)
hotset
- Set of hot itemsk
- target sizepublic TypeInformation[] getInputTypeRestriction()
AbstractAlgorithm
getInputTypeRestriction
in interface Algorithm
getInputTypeRestriction
in class AbstractAlgorithm<CollectionResult<double[]>>
protected Logging getLogger()
AbstractAlgorithm
getLogger
in class AbstractAlgorithm<CollectionResult<double[]>>
Copyright © 2019 ELKI Development Team. License information.