Module es.upm.fi.cig.multictbnc
Class ConceptDriftLocallyAdaptiveMethod
java.lang.Object
es.upm.fi.cig.multictbnc.conceptdriftdetection.ConceptDriftAdaptiveMethod
es.upm.fi.cig.multictbnc.conceptdriftdetection.ConceptDriftLocallyAdaptiveMethod
This class implements a concept drift adaptive method that operates locally on each node of a MultiCTBNC model.
The method utilizes a Page-Hinkley test to detect significant changes in the local log-likelihood scores of
individual nodes, indicating possible concept drifts. Upon detection, the model is adapted accordingly.
-
Constructor Summary
ConstructorsConstructorDescriptionConceptDriftLocallyAdaptiveMethod(List<String> namesVariables, ConceptDriftScore conceptDriftScore, double magnitudeThreshold, double detectionThreshold, boolean resetAfterConceptDrift, int windowSize, boolean showCharts, String title) Initializes the locally adaptive concept drift method with specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionbooleanadaptModel(MultiCTBNC<CPTNode, CIMNode> model, Dataset newBatch) Adapts the provided MultiCTBNC model based on the new data batch.Retrieves the list of nodes that were last identified as having undergone concept drift.Returns aStringdescribing the results of the last concept drift detection.longReturns the time taken for the last update of the model.protected voidsetUpLineChart(String title, double detectionThreshold) Sets up line charts for visualizing the evolution of the average local log-likelihood and Page Hinkley values if the charts are enabled.
-
Constructor Details
-
ConceptDriftLocallyAdaptiveMethod
public ConceptDriftLocallyAdaptiveMethod(List<String> namesVariables, ConceptDriftScore conceptDriftScore, double magnitudeThreshold, double detectionThreshold, boolean resetAfterConceptDrift, int windowSize, boolean showCharts, String title) Initializes the locally adaptive concept drift method with specified parameters.- Parameters:
namesVariables- list of variable names used in the modelconceptDriftScore- scoring mechanism to detect concept driftmagnitudeThreshold- threshold for magnitude change in the Page-Hinkley testdetectionThreshold- threshold for drift detection in the Page-Hinkley testresetAfterConceptDrift- flag to reset the Page-Hinkley test after detecting a driftwindowSize- size of the window for the Page-Hinkley testshowCharts- flag indicating whether to display drift detection chartstitle- title for the drift detection charts
-
-
Method Details
-
setUpLineChart
Sets up line charts for visualizing the evolution of the average local log-likelihood and Page Hinkley values if the charts are enabled.- Specified by:
setUpLineChartin classConceptDriftAdaptiveMethod- Parameters:
title- title for the line chartsdetectionThreshold- threshold value for detecting concept drifts
-
adaptModel
public boolean adaptModel(MultiCTBNC<CPTNode, CIMNode> model, Dataset newBatch) throws ErroneousValueExceptionAdapts the provided MultiCTBNC model based on the new data batch. It detects concept drifts and updates the model accordingly.- Specified by:
adaptModelin classConceptDriftAdaptiveMethod- Parameters:
model- MultiCTBNC model to be adapted.newBatch- new data batch for concept drift detection and model adaptation- Returns:
trueif a concept drift is detected and the model is adapted,falseotherwise- Throws:
ErroneousValueException- if an error occurs during the adaptation process
-
getResults
Description copied from class:ConceptDriftAdaptiveMethodReturns aStringdescribing the results of the last concept drift detection.- Specified by:
getResultsin classConceptDriftAdaptiveMethod- Returns:
- String describing the concept drift detection results
-
getUpdatingTime
public long getUpdatingTime()Description copied from class:ConceptDriftAdaptiveMethodReturns the time taken for the last update of the model.- Overrides:
getUpdatingTimein classConceptDriftAdaptiveMethod- Returns:
- time taken for updating the model
-
getLastChangedNodes
Description copied from class:ConceptDriftAdaptiveMethodRetrieves the list of nodes that were last identified as having undergone concept drift.- Specified by:
getLastChangedNodesin classConceptDriftAdaptiveMethod- Returns:
- list of nodes that experienced concept drift in the most recent adaptation
-