Class EvaluateRetrievalPerformance<O>

  • Type Parameters:
    O - Object type
    All Implemented Interfaces:
    Algorithm

    public class EvaluateRetrievalPerformance<O>
    extends java.lang.Object
    implements Algorithm
    Evaluate a distance functions performance by computing the mean average precision, ROC, and NN classification performance when ranking the objects by distance.
    Since:
    0.7.0
    Author:
    Erich Schubert
    • Field Detail

      • LOG

        private static final Logging LOG
        The logger for this class.
      • PREFIX

        private final java.lang.String PREFIX
        Prefix for statistics.
      • distance

        protected Distance<? super O> distance
        Distance function used.
      • sampling

        protected double sampling
        Relative number of object to use in sampling.
      • includeSelf

        protected boolean includeSelf
        Include query object in evaluation.
      • maxk

        protected int maxk
        K nearest neighbors to use for classification evaluation.
    • Constructor Detail

      • EvaluateRetrievalPerformance

        public EvaluateRetrievalPerformance​(Distance<? super O> distance,
                                            double sampling,
                                            RandomFactory random,
                                            boolean includeSelf,
                                            int maxk)
        Constructor.
        Parameters:
        distance - Distance function
        sampling - Sampling rate
        random - Random sampling generator
        includeSelf - Include query object in evaluation
        maxk - Maximum k for kNN evaluation
    • 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
      • match

        protected static boolean match​(java.lang.Object ref,
                                       java.lang.Object test)
        Test whether two relation agree.
        Parameters:
        ref - Reference object
        test - Test object
        Returns:
        true if the objects match
      • findMatches

        private void findMatches​(ModifiableDBIDs posn,
                                 Relation<?> lrelation,
                                 java.lang.Object label)
        Find all matching objects.
        Parameters:
        posn - Output set.
        lrelation - Label relation
        label - Query object label
      • computeDistances

        private void computeDistances​(ModifiableDoubleDBIDList nlist,
                                      DBIDIter query,
                                      DistanceQuery<O> distQuery,
                                      Relation<O> relation)
        Compute the distances to the neighbor objects.
        Parameters:
        nlist - Neighbor list (output)
        query - Query object
        distQuery - Distance function
        relation - Data relation