Class 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
    • Field Detail

      • LOG

        private static final Logging LOG
        Class logger.
      • PREFIX

        private static final java.lang.String PREFIX
        Statistics prefix.
      • distance

        private Distance<? super O> distance
        Distance function used.
      • 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).
    • Constructor Detail

      • DistanceQuantileSampler

        public DistanceQuantileSampler​(Distance<? super O> distance,
                                       double quantile,
                                       double sampling,
                                       boolean nozeros,
                                       RandomFactory rand)
        Constructor.
        Parameters:
        distance - Distance function
        quantile - Quantile to compute
        sampling - Sampling rate
        nozeros - 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 interface Algorithm
        Returns:
        Type restriction
      • run

        public CollectionResult<double[]> run​(Relation<O> relation)
        Run the distance quantile sampler.
        Parameters:
        relation - Data relation
        Returns:
        Distances sample