jsat.driftdetectors
Class DDM<V>
- java.lang.Object
-
- jsat.driftdetectors.BaseDriftDetector<V>
-
- jsat.driftdetectors.DDM<V>
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable
public class DDM<V> extends BaseDriftDetector<V>
DDM (Drift Detection Method) is a drift detector for binary events, and is meant to detect decreases in the success rate over time. As such it will not inform of any positive drift.
This drift detector supports a warning state, and will not begin to store the object history until a warning state begins. If the warning state ends before a detection of drift occurs, the history will be dropped.
See: Gama, J., Medas, P., Castillo, G.,&Rodrigues, P. (2004). Learning with Drift Detection. In A. C. Bazzan&S. Labidi (Eds.), Advances in Artificial Intelligence – SBIA 2004 (pp. 286–295). Springer Berlin Heidelberg. doi:10.1007/978-3-540-28645-5_29- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description DDM()Creates a new DDM drift detector using the default warning and drift thresholds of 2 and 3 respectively.DDM(DDM<V> toCopy)Copy constructorDDM(double warningThreshold, double driftThreshold)Creates a new DDM drift detector
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanaddSample(boolean trial, V obj)Adds a new boolean trial to the detector, with the goal of detecting when the number of successful trials (true) drifts to a new value.booleanaddSample(double value, V obj)Adds a new point to the drift detector.DDM<V>clone()voiddriftHandled()This method should be called once the drift is handled.doublegetDriftThreshold()Returns the threshold multiple for controlling the false positive / negative rate on detecting changes.doublegetSuccessRate()Returns the current estimate of the success rate (number oftrueinputs) for the model.doublegetWarningThreshold()Returns the threshold multiple for controlling the false positive / negative rate on detecting changes.voidsetDriftThreshold(double driftThreshold)Sets the multiplier on the standard deviation that must be exceeded to recognize the change as a drift.voidsetWarningThreshold(double warningThreshold)Sets the multiplier on the standard deviation that must be exceeded to initiate a warning state.-
Methods inherited from class jsat.driftdetectors.BaseDriftDetector
clearHistory, getDriftAge, getDriftedHistory, getMaxHistory, isDrifting, isWarning, setMaxHistory
-
-
-
-
Constructor Detail
-
DDM
public DDM()
Creates a new DDM drift detector using the default warning and drift thresholds of 2 and 3 respectively.
-
DDM
public DDM(double warningThreshold, double driftThreshold)Creates a new DDM drift detector- Parameters:
warningThreshold- the threshold for starting a warning statedriftThreshold- the threshold for recognizing a drift
-
-
Method Detail
-
getSuccessRate
public double getSuccessRate()
Returns the current estimate of the success rate (number oftrueinputs) for the model.- Returns:
- the current estimate of the success rate
-
addSample
public boolean addSample(boolean trial, V obj)Adds a new boolean trial to the detector, with the goal of detecting when the number of successful trials (true) drifts to a new value. This detector begins storing a history of theobjinputs only once it has entered a warning state.
This detector is specifically meant to detect drops in the success rate, and will not cause any warning or drift detections for increases in the success rate.- Parameters:
trial- the result of the trialobj- the object to associate with the trial- Returns:
trueif we are in a warning or drift state,falseif we are not
-
setWarningThreshold
public void setWarningThreshold(double warningThreshold)
Sets the multiplier on the standard deviation that must be exceeded to initiate a warning state. Once in the warning state, DDM will begin to collect a history of the inputs
Increasing the warning threshold makes it take longer to start detecting a change, but reduces false positives.
If the warning threshold is set above thesetDriftThreshold(double), the drift state will not occur until the warning state is reached, and the warning state will be skipped.- Parameters:
warningThreshold- the positive multiplier threshold for starting a warning state
-
getWarningThreshold
public double getWarningThreshold()
Returns the threshold multiple for controlling the false positive / negative rate on detecting changes.- Returns:
- the threshold multiple for controlling warning detection
-
setDriftThreshold
public void setDriftThreshold(double driftThreshold)
Sets the multiplier on the standard deviation that must be exceeded to recognize the change as a drift.
Increasing the drift threshold makes it take longer to start detecting a change, but reduces false positives.- Parameters:
driftThreshold- the positive multiplier threshold for detecting a drift
-
getDriftThreshold
public double getDriftThreshold()
Returns the threshold multiple for controlling the false positive / negative rate on detecting changes.- Returns:
- the threshold for controlling drift detection
-
addSample
public boolean addSample(double value, V obj)Description copied from class:BaseDriftDetectorAdds a new point to the drift detector. If an escalation in state occurs,truewill be returned. A change of state could be either drift occurringBaseDriftDetector.isDrifting()or a warning stateBaseDriftDetector.isWarning(). If the detector was in a warning state and then goes back to normal,falsewill be returned.
For binary (true / false) drift detectors,valuewill be consideredfalseif and only if its value is equal to zero. Any non zero value will be treated astrue
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.- Specified by:
addSamplein classBaseDriftDetector<V>- Parameters:
value- the numeric value to add to the drift detectorobj- the object associated with this value. It may or may not be stored in the detectors history- Returns:
trueif a drift has or may be starting.
-
driftHandled
public void driftHandled()
Description copied from class:BaseDriftDetectorThis 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.- Overrides:
driftHandledin classBaseDriftDetector<V>
-
clone
public DDM<V> clone()
- Specified by:
clonein classBaseDriftDetector<V>
-
-
DataMelt 3.0 © DataMelt by jWork.ORG