Class LOF<O>

  • Type Parameters:
    O - the type of data objects handled by this algorithm
    All Implemented Interfaces:
    elki.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
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface elki.Algorithm

        elki.Algorithm.Utils
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected elki.distance.Distance<? super O> distance
      Distance function used.
      protected int kplus
      The number of neighbors to query (plus the query point!)
      private static elki.logging.Logging LOG
      The logger for this class.
    • Constructor Summary

      Constructors 
      Constructor Description
      LOF​(int k, elki.distance.Distance<? super O> distance)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected double computeLOFScore​(elki.database.query.knn.KNNSearcher<elki.database.ids.DBIDRef> knnq, elki.database.ids.DBIDRef cur, elki.database.datastore.DoubleDataStore lrds)
      Compute a single LOF score.
      private void computeLOFScores​(elki.database.query.knn.KNNSearcher<elki.database.ids.DBIDRef> knnq, elki.database.ids.DBIDs ids, elki.database.datastore.DoubleDataStore lrds, elki.database.datastore.WritableDoubleDataStore lofs, elki.math.DoubleMinMax lofminmax)
      Compute local outlier factors.
      protected double computeLRD​(elki.database.query.knn.KNNSearcher<elki.database.ids.DBIDRef> knnq, elki.database.ids.DBIDIter curr)
      Compute a single local reachability distance.
      private void computeLRDs​(elki.database.query.knn.KNNSearcher<elki.database.ids.DBIDRef> knnq, elki.database.ids.DBIDs ids, elki.database.datastore.WritableDoubleDataStore lrds)
      Compute local reachability distances.
      elki.data.type.TypeInformation[] getInputTypeRestriction()  
      OutlierResult run​(elki.database.relation.Relation<O> relation)
      Runs the LOF algorithm on the given database.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOG

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

        protected elki.distance.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,
                   elki.distance.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 elki.data.type.TypeInformation[] getInputTypeRestriction()
        Specified by:
        getInputTypeRestriction in interface elki.Algorithm
      • run

        public OutlierResult run​(elki.database.relation.Relation<O> relation)
        Runs the LOF algorithm on the given database.
        Parameters:
        relation - Data to process
        Returns:
        LOF outlier result
      • computeLRDs

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

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

        private void computeLOFScores​(elki.database.query.knn.KNNSearcher<elki.database.ids.DBIDRef> knnq,
                                      elki.database.ids.DBIDs ids,
                                      elki.database.datastore.DoubleDataStore lrds,
                                      elki.database.datastore.WritableDoubleDataStore lofs,
                                      elki.math.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​(elki.database.query.knn.KNNSearcher<elki.database.ids.DBIDRef> knnq,
                                         elki.database.ids.DBIDRef cur,
                                         elki.database.datastore.DoubleDataStore lrds)
        Compute a single LOF score.
        Parameters:
        knnq - kNN query
        cur - Current object
        lrds - Stored reachability densities
        Returns:
        LOF score.