Class TopKOutlierScaling

  • All Implemented Interfaces:
    OutlierScaling, ScalingFunction

    public class TopKOutlierScaling
    extends java.lang.Object
    implements OutlierScaling
    Outlier scaling function that only keeps the top k outliers.
    Since:
    0.3
    Author:
    Erich Schubert
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  TopKOutlierScaling.Par
      Parameterization class.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean binary
      Do a binary decision
      private double cutoff
      The value we cut off at.
      private double ground
      The "ground" value
      private int k
      Number of outliers to keep.
      private double max
      The maximum value
    • Constructor Summary

      Constructors 
      Constructor Description
      TopKOutlierScaling​(int k, boolean binary)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double getMax()
      Get maximum resulting value.
      double getMin()
      Get minimum resulting value.
      double getScaled​(double value)
      Transform a given value using the scaling function.
      <A> void prepare​(A array, NumberArrayAdapter<?,​A> adapter)
      Prepare is called once for each data set, before getScaled() will be called.
      void prepare​(OutlierResult or)
      Prepare is called once for each data set, before getScaled() will be called.
      • Methods inherited from class java.lang.Object

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

      • k

        private int k
        Number of outliers to keep.
      • binary

        private boolean binary
        Do a binary decision
      • cutoff

        private double cutoff
        The value we cut off at.
      • ground

        private double ground
        The "ground" value
      • max

        private double max
        The maximum value
    • Constructor Detail

      • TopKOutlierScaling

        public TopKOutlierScaling​(int k,
                                  boolean binary)
        Constructor.
        Parameters:
        k - Number of elements to keep
        binary - Use binary scores, or retain the top k values
    • Method Detail

      • prepare

        public void prepare​(OutlierResult or)
        Description copied from interface: OutlierScaling
        Prepare is called once for each data set, before getScaled() will be called. This function can be used to extract global parameters such as means, minimums or maximums from the outlier scores.
        Specified by:
        prepare in interface OutlierScaling
        Parameters:
        or - Outlier result to use
      • prepare

        public <A> void prepare​(A array,
                                NumberArrayAdapter<?,​A> adapter)
        Description copied from interface: OutlierScaling
        Prepare is called once for each data set, before getScaled() will be called. This function can be used to extract global parameters such as means, minimums or maximums from the score array. The method using a full OutlierResult is preferred, as it will allow access to the metadata.
        Specified by:
        prepare in interface OutlierScaling
        Parameters:
        array - Data to process
        adapter - Array adapter
      • getMax

        public double getMax()
        Description copied from interface: ScalingFunction
        Get maximum resulting value. May be Double.NaN or Double.POSITIVE_INFINITY.
        Specified by:
        getMax in interface ScalingFunction
        Returns:
        Maximum resulting value.
      • getMin

        public double getMin()
        Description copied from interface: ScalingFunction
        Get minimum resulting value. May be Double.NaN or Double.NEGATIVE_INFINITY.
        Specified by:
        getMin in interface ScalingFunction
        Returns:
        Minimum resulting value.
      • getScaled

        public double getScaled​(double value)
        Description copied from interface: ScalingFunction
        Transform a given value using the scaling function.
        Specified by:
        getScaled in interface ScalingFunction
        Parameters:
        value - Original value
        Returns:
        Scaled value