Package elki.outlier

Class DWOF<O>

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

    @Title("DWOF: Dynamic Window Outlier Factor")
    @Description("Algorithm to compute dynamic-window outlier factors in a database based on the neighborhood size parameter \'k\'")
    @Reference(authors="R. Momtaz, N. Mohssen, M. A. Gowayyed",
               title="DWOF: A Robust Density-Based Outlier Detection Approach",
               booktitle="Proc. 6th Iberian Conf. Pattern Recognition and Image Analysis (IbPRIA 2013)",
               url="https://doi.org/10.1007/978-3-642-38628-2_61",
               bibkey="DBLP:conf/ibpria/MomtazMG13")
    public class DWOF<O>
    extends java.lang.Object
    implements OutlierAlgorithm
    Algorithm to compute dynamic-window outlier factors in a database based on a specified parameter k, which specifies the number of the neighbors to be considered during the calculation of the DWOF score.

    Reference:

    Rana Momtaz, Nesma Mohssen and Mohammad A. Gowayyed:
    DWOF: A Robust Density-Based OutlierDetection Approach.
    Proc. 6th Iberian Conf. Pattern Recognition and Image Analysis (IbPRIA 2013)

    Since:
    0.6.0
    Author:
    Omar Yousry
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface elki.Algorithm

        elki.Algorithm.Utils
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected double delta
      The radii changing ratio
      protected elki.distance.Distance<? super O> distance
      Distance function used.
      protected int kplus
      Holds the value of DWOF.Par.K_ID i.e.
      private static elki.logging.Logging LOG
      The logger for this class.
    • Constructor Summary

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void clusterData​(elki.database.ids.DBIDs ids, elki.database.query.range.RangeSearcher<elki.database.ids.DBIDRef> rnnQuery, elki.database.datastore.WritableDoubleDataStore radii, elki.database.datastore.WritableDataStore<elki.database.ids.ModifiableDBIDs> labels)
      This method applies a density based clustering algorithm.
      elki.data.type.TypeInformation[] getInputTypeRestriction()  
      private void initializeRadii​(elki.database.ids.DBIDs ids, elki.database.query.knn.KNNSearcher<elki.database.ids.DBIDRef> knnq, elki.database.query.distance.DistanceQuery<O> distFunc, elki.database.datastore.WritableDoubleDataStore radii)
      This method prepares a container for the radii of the objects and initializes radii according to the equation: initialRadii of a certain object = (absoluteMinDist of all objects) * (avgDist of the object) / (minAvgDist of all objects)
      OutlierResult run​(elki.database.relation.Relation<O> relation)
      Performs the Generalized DWOF_SCORE algorithm on the given database by calling all the other methods in the proper order.
      private int updateSizes​(elki.database.ids.DBIDs ids, elki.database.datastore.WritableDataStore<elki.database.ids.ModifiableDBIDs> labels, elki.database.datastore.WritableIntegerDataStore newSizes)
      This method updates each object's cluster size after the clustering step.
      • 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
        Holds the value of DWOF.Par.K_ID i.e. Number of neighbors to consider during the calculation of DWOF scores + the query point.
      • delta

        protected double delta
        The radii changing ratio
    • Constructor Detail

      • DWOF

        public DWOF​(elki.distance.Distance<? super O> distance,
                    int k,
                    double delta)
        Constructor.
        Parameters:
        distance - Distance function to use in queries
        k - the value of k
        delta - Radius increase factor
    • 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)
        Performs the Generalized DWOF_SCORE algorithm on the given database by calling all the other methods in the proper order.
        Parameters:
        relation - Data to process
        Returns:
        new OutlierResult instance
      • initializeRadii

        private void initializeRadii​(elki.database.ids.DBIDs ids,
                                     elki.database.query.knn.KNNSearcher<elki.database.ids.DBIDRef> knnq,
                                     elki.database.query.distance.DistanceQuery<O> distFunc,
                                     elki.database.datastore.WritableDoubleDataStore radii)
        This method prepares a container for the radii of the objects and initializes radii according to the equation: initialRadii of a certain object = (absoluteMinDist of all objects) * (avgDist of the object) / (minAvgDist of all objects)
        Parameters:
        ids - Database IDs to process
        distFunc - Distance function
        knnq - kNN search function
        radii - WritableDoubleDataStore to store radii
      • clusterData

        private void clusterData​(elki.database.ids.DBIDs ids,
                                 elki.database.query.range.RangeSearcher<elki.database.ids.DBIDRef> rnnQuery,
                                 elki.database.datastore.WritableDoubleDataStore radii,
                                 elki.database.datastore.WritableDataStore<elki.database.ids.ModifiableDBIDs> labels)
        This method applies a density based clustering algorithm. It looks for an unclustered object and builds a new cluster for it, then adds all the points within its radius to that cluster. nChain represents the points to be added to the cluster and its radius-neighbors
        Parameters:
        ids - Database IDs to process
        rnnQuery - Data to process
        radii - Radii to cluster accordingly
        labels - Label storage.
      • updateSizes

        private int updateSizes​(elki.database.ids.DBIDs ids,
                                elki.database.datastore.WritableDataStore<elki.database.ids.ModifiableDBIDs> labels,
                                elki.database.datastore.WritableIntegerDataStore newSizes)
        This method updates each object's cluster size after the clustering step.
        Parameters:
        ids - Object IDs to process
        labels - references for each object's cluster
        newSizes - the sizes container to be updated
        Returns:
        the number of unclustered objects