Documentation of 'jsat.driftdetectors.BaseDriftDetector' Java class
BaseDriftDetector
jsat.driftdetectors

Class BaseDriftDetector<V>

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable
    Direct Known Subclasses:
    ADWIN, DDM


    public abstract class BaseDriftDetector<V>
    extends java.lang.Object
    implements java.lang.Cloneable, java.io.Serializable
    Base class for providing common functionality to drift detection algorithms
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method and Description
      abstract boolean addSample(double value, V obj)
      Adds a new point to the drift detector.
      void clearHistory()
      Clears the current history
      abstract java.lang.Object clone() 
      void driftHandled()
      This method should be called once the drift is handled.
      int getDriftAge()
      Returns the number of items in recent history that differed from the historical values, or -1 if there has not been any detected drift.
      java.util.List<V> getDriftedHistory()
      Returns a new list containing up to getMaxHistory() objects in the history that drifted away from the prior state of the model.
      int getMaxHistory()
      Returns the maximum number of items that will be kept in the history.
      boolean isDrifting()
      Returns true if the algorithm believes that drift has definitely occurred.
      boolean isWarning()
      Returns true if the algorithm is in a warning state.
      void setMaxHistory(int maxHistory)
      Sets the maximum number of items to store in history.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • isWarning

        public boolean isWarning()
        Returns true if the algorithm is in a warning state. This state indicates that the algorithm believes concept drift may be occurring, but is not confident enough to say that is had definitely occurred.
        Not all algorithms will raise a warning state, and some may only begin keeping track of history once in the warning state.
        Returns:
        true if concept drift may have started, but is not sure
      • isDrifting

        public boolean isDrifting()
        Returns true if the algorithm believes that drift has definitely occurred. At this
        Returns:
      • getMaxHistory

        public int getMaxHistory()
        Returns the maximum number of items that will be kept in the history.
        Returns:
        the maximum number of items that will be kept in the history.
      • setMaxHistory

        public void setMaxHistory(int maxHistory)
        Sets the maximum number of items to store in history. Setting this to 0 will keep the detector from ever storing history.
        The user can still keep their own independent history or checkpoints by using the isDrifting() and isWarning() methods.

        The history size may be changed at any time, but may result in the loss of history.
        Parameters:
        maxHistory - the new maximum history size of objects added
      • clearHistory

        public void clearHistory()
        Clears the current history
      • getDriftAge

        public int getDriftAge()
        Returns the number of items in recent history that differed from the historical values, or -1 if there has not been any detected drift. This method will return -1 even if isWarning() is true.
        Returns:
        the number of updates ago that the drift started, or -1 if no drift has occurred
      • getDriftedHistory

        public java.util.List<V> getDriftedHistory()
        Returns a new list containing up to getMaxHistory() objects in the history that drifted away from the prior state of the model.
        The 0 index in the list will be the most recently added item, and the largest index will be the oldest item.
        Returns:
        the list of objects that make up the effected history
      • addSample

        public abstract boolean addSample(double value,
                                          V obj)
        Adds a new point to the drift detector. If an escalation in state occurs, true will be returned. A change of state could be either drift occurring isDrifting() or a warning state isWarning(). If the detector was in a warning state and then goes back to normal, false will be returned.

        For binary (true / false) drift detectors, value will be considered false if and only if its value is equal to zero. Any non zero value will be treated as true

        Objects added with the value may or may not be added to the history, the behavior is algorithm dependent. Some may always add it to the history, while others will only begin collecting history once a warning state occurs.
        Parameters:
        value - the numeric value to add to the drift detector
        obj - the object associated with this value. It may or may not be stored in the detectors history
        Returns:
        true if a drift has or may be starting.
        Throws:
        UnhandledDriftException - if driftHandled() is not called after drifting is detected
      • driftHandled

        public void driftHandled()
        This method should be called once the drift is handled. Once done, this method will clear the flags and prepare the detector to continue tracking drift again.
        By using this method, one can continue to track multiple future drift changes without having to feed the history data (which may be incomplete) into a new detector object.
      • clone

        public abstract java.lang.Object clone()
        Overrides:
        clone in class java.lang.Object

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.