Class KNNOutlier<O>

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

    @Title("KNN outlier: Efficient Algorithms for Mining Outliers from Large Data Sets")
    @Description("Outlier Detection based on the distance of an object to its k nearest neighbor.")
    @Reference(authors="S. Ramaswamy, R. Rastogi, K. Shim",
               title="Efficient Algorithms for Mining Outliers from Large Data Sets",
               booktitle="Proc. Int. Conf. on Management of Data (SIGMOD 2000)",
               url="https://doi.org/10.1145/342009.335437",
               bibkey="DBLP:conf/sigmod/RamaswamyRS00")
    @Alias("knno")
    @Priority(200)
    public class KNNOutlier<O>
    extends java.lang.Object
    implements OutlierAlgorithm
    Outlier Detection based on the distance of an object to its k nearest neighbor.

    This implementation differs from the original pseudocode: the k nearest neighbors do not exclude the point that is currently evaluated. I.e. for k=1 the resulting score is the distance to the 1-nearest neighbor that is not the query point and therefore should match k=2 in the exact pseudocode - a value of k=1 in the original code does not make sense, as the 1NN distance will be 0 for every point in the database. If you for any reason want to use the original algorithm, subtract 1 from the k parameter.

    Reference:

    S. Ramaswamy, R. Rastogi, K. Shim
    Efficient Algorithms for Mining Outliers from Large Data Sets.
    In: Proc. Int. Conf. on Management of Data (SIGMOD 2000)

    Since:
    0.3
    Author:
    Lisa Reichert
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  KNNOutlier.Par<O>
      Parameterization class.
      • 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 parameter k (plus query point!)
      private static elki.logging.Logging LOG
      The logger for this class.
    • Constructor Summary

      Constructors 
      Constructor Description
      KNNOutlier​(elki.distance.Distance<? super O> distance, int k)
      Constructor for a single kNN query.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      elki.data.type.TypeInformation[] getInputTypeRestriction()  
      OutlierResult run​(elki.database.relation.Relation<O> relation)
      Runs the algorithm in the timed evaluation part.
      • 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 parameter k (plus query point!)
    • Constructor Detail

      • KNNOutlier

        public KNNOutlier​(elki.distance.Distance<? super O> distance,
                          int k)
        Constructor for a single kNN query.
        Parameters:
        distance - distance function to use
        k - Value of k (excluding query point!)
    • 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 algorithm in the timed evaluation part.
        Parameters:
        relation - Data relation