Fixing KDE evaluate() to return correct ValueAndMagnitude object #128602
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #127517 describes
ChangePointDetector.getChangeType()
failing to detect a spike when all non spike values are constant (for example, the input [51,51,...,51,50001,51...,51]).Prior to this change, the
KDE.evaluate()
method would return a special object for an input withbandwidth == 0
. This would occur if the values excluding the spike had zero variance (seeKDE
constructor). This would then causeChangePointDetector.getChangeType()
andSpikeAndDipDetector.detect()
to use the wrong p-value and fail to detect the spike.This change removes the
bandwidth == 0
condition for returning a specialValueAndMagnitude
object. Statistical testing inChangePointDetector.getChangeType()
andSpikeAndDipDetector.detect()
now properly detect the spike in the example mentioned above.Unit tests are added to confirm the bug is fixed.
Closes #127517