Package elki.algorithm.statistics
Class DistanceQuantileSampler<O>
- java.lang.Object
-
- elki.algorithm.statistics.DistanceQuantileSampler<O>
-
- Type Parameters:
O
- Object type
- All Implemented Interfaces:
Algorithm
public class DistanceQuantileSampler<O> extends java.lang.Object implements Algorithm
Compute a quantile of a distance sample, useful for choosing parameters for algorithms.TODO: allow specifying multiple quantiles.
- Since:
- 0.7.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DistanceQuantileSampler.Par<O>
Parameterization class-
Nested classes/interfaces inherited from interface elki.Algorithm
Algorithm.Utils
-
-
Field Summary
Fields Modifier and Type Field Description private Distance<? super O>
distance
Distance function used.private static Logging
LOG
Class logger.private boolean
nozeros
Flag to ignore zero distances (recommended with many duplicates).private static java.lang.String
PREFIX
Statistics prefix.private double
quantile
Quantile to compute.private RandomFactory
rand
Random generator.private double
sampling
Sampling rate.
-
Constructor Summary
Constructors Constructor Description DistanceQuantileSampler(Distance<? super O> distance, double quantile, double sampling, boolean nozeros, RandomFactory rand)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TypeInformation[]
getInputTypeRestriction()
Get the input type restriction used for negotiating the data query.CollectionResult<double[]>
run(Relation<O> relation)
Run the distance quantile sampler.
-
-
-
Field Detail
-
LOG
private static final Logging LOG
Class logger.
-
PREFIX
private static final java.lang.String PREFIX
Statistics prefix.
-
quantile
private double quantile
Quantile to compute.
-
sampling
private double sampling
Sampling rate.
-
nozeros
private boolean nozeros
Flag to ignore zero distances (recommended with many duplicates).
-
rand
private RandomFactory rand
Random generator.
-
-
Constructor Detail
-
DistanceQuantileSampler
public DistanceQuantileSampler(Distance<? super O> distance, double quantile, double sampling, boolean nozeros, RandomFactory rand)
Constructor.- Parameters:
distance
- Distance functionquantile
- Quantile to computesampling
- Sampling ratenozeros
- Flag to ignore zero distances (recommended with many duplicates)rand
- Random generator
-
-
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 CollectionResult<double[]> run(Relation<O> relation)
Run the distance quantile sampler.- Parameters:
relation
- Data relation- Returns:
- Distances sample
-
-