Class LOF<O>

  • Type Parameters:
    O - the type of data objects handled by this algorithm
    All Implemented Interfaces:
    Algorithm, OutlierAlgorithm

    @Title("LOF: Local Outlier Factor")
    @Description("Algorithm to compute density-based local outlier factors in a database based on the neighborhood size parameter \'k\'")
    @Reference(authors="Markus M. Breunig, Hans-Peter Kriegel, Raymond Ng, J\u00f6rg Sander",
               title="LOF: Identifying Density-Based Local Outliers",
               booktitle="Proc. 2nd ACM SIGMOD Int. Conf. on Management of Data (SIGMOD\'00)",
               url="https://doi.org/10.1145/342009.335388",
               bibkey="DBLP:conf/sigmod/BreunigKNS00")
    @Priority(200)
    public class LOF<O>
    extends java.lang.Object
    implements OutlierAlgorithm
    Algorithm to compute density-based local outlier factors in a database based on a specified parameter -lof.k.

    The original LOF parameter was called "minPts", but for consistency within ELKI we have renamed this parameter to "k".

    Compatibility note: as of ELKI 0.7.0, we no longer include the query point, for consistency with other methods.

    Reference:

    Markus M. Breunig, Hans-Peter Kriegel, Raymond Ng, Jörg Sander
    LOF: Identifying Density-Based Local Outliers
    Proc. 2nd ACM SIGMOD Int. Conf. on Management of Data (SIGMOD'00)

    Since:
    0.2
    Author:
    Erich Schubert, Elke Achtert
    • Field Detail

      • LOG

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

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

        protected int kplus
        The number of neighbors to query (plus the query point!)
    • Constructor Detail

      • LOF

        public LOF​(int k,
                   Distance<? super O> distance)
        Constructor.
        Parameters:
        k - the number of neighbors to use for comparison (excluding the query point)
        distance - the neighborhood distance function
    • 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 OutlierResult run​(Relation<O> relation)
        Runs the LOF algorithm on the given database.
        Parameters:
        relation - Data to process
        Returns:
        LOF outlier result
      • computeLRDs

        private void computeLRDs​(KNNSearcher<DBIDRef> knnq,
                                 DBIDs ids,
                                 WritableDoubleDataStore lrds)
        Compute local reachability distances.
        Parameters:
        knnq - KNN query
        ids - IDs to process
        lrds - Reachability storage
      • computeLRD

        protected double computeLRD​(KNNSearcher<DBIDRef> knnq,
                                    DBIDIter curr)
        Compute a single local reachability distance.
        Parameters:
        knnq - kNN Query
        curr - Current object
        Returns:
        Local Reachability Density
      • computeLOFScores

        private void computeLOFScores​(KNNSearcher<DBIDRef> knnq,
                                      DBIDs ids,
                                      DoubleDataStore lrds,
                                      WritableDoubleDataStore lofs,
                                      DoubleMinMax lofminmax)
        Compute local outlier factors.
        Parameters:
        knnq - KNN query
        ids - IDs to process
        lrds - Local reachability distances
        lofs - Local outlier factor storage
        lofminmax - Score minimum/maximum tracker
      • computeLOFScore

        protected double computeLOFScore​(KNNSearcher<DBIDRef> knnq,
                                         DBIDRef cur,
                                         DoubleDataStore lrds)
        Compute a single LOF score.
        Parameters:
        knnq - kNN query
        cur - Current object
        lrds - Stored reachability densities
        Returns:
        LOF score.