public abstract class BaseDriftDetector<V> extends Object implements Cloneable, Serializable
Modifier and Type | Field and Description |
---|---|
protected boolean |
drifting
Set to
true to indicate that concept drift has occurred |
protected int |
driftStart
Set this value to the time point where the drift is believed to have
started from.
|
protected Deque<V> |
history
Holds the associated object history.
|
protected int |
maxHistory
Controls the maximum amount of history to keep
|
protected int |
time
Tracks the number of updates / trial scene.
|
protected boolean |
warning
Set to
true to indicate that a warning mode in in effect. |
Modifier | Constructor and Description |
---|---|
protected |
BaseDriftDetector() |
protected |
BaseDriftDetector(BaseDriftDetector<V> toCopy)
Copy constructor
|
Modifier and Type | Method and Description |
---|---|
abstract boolean |
addSample(double value,
V obj)
Adds a new point to the drift detector.
|
protected void |
addToHistory(V obj)
Adds the given item to the history, creating a new history holder if
needed.
|
void |
clearHistory()
Clears the current history
|
abstract 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. |
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.
|
protected int time
driftStart
protected int maxHistory
protected boolean warning
true
to indicate that a warning mode in in effect.protected boolean drifting
true
to indicate that concept drift has occurredprotected int driftStart
protected BaseDriftDetector()
protected BaseDriftDetector(BaseDriftDetector<V> toCopy)
toCopy
- the object to copypublic boolean isWarning()
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. true
if concept drift may have started, but is not surepublic boolean isDrifting()
true
if the algorithm believes that drift has definitely
occurred. At thispublic int getMaxHistory()
public void setMaxHistory(int maxHistory)
0
will keep the detector from ever storing history. isDrifting()
and isWarning()
methods. maxHistory
- the new maximum history size of objects addedprotected void addToHistory(V obj)
obj
- the object to add to the historypublic void clearHistory()
public int getDriftAge()
-1
if there has not been any detected
drift. This method will return -1
even if isWarning()
is true
.-1
if no drift has occurredpublic List<V> getDriftedHistory()
getMaxHistory()
objects in
the history that drifted away from the prior state of the model. public abstract boolean addSample(double value, V obj)
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. value
will be
considered false
if and only if its value is equal to zero. Any
non zero value will be treated as true
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 historytrue
if a drift has or may be starting.UnhandledDriftException
- if driftHandled()
is not called
after drifting is detectedpublic void driftHandled()
Copyright © 2017. All rights reserved.