Skip to content

Conversation

@sd2k
Copy link
Collaborator

@sd2k sd2k commented Jun 10, 2025

Fixes #67.

Claude's commit description below:


  • Fixed detectAnomalies(): Now compares predictions vs bounds instead
    actual of vs bounds

  • Added null handling: Properly skips out-of-sample predictions (null values)

  • Updated type signatures: Support null values in originalValues array

  • Extracted testable function: Made detectAnomalies() independently testable

  • Added comprehensive test suite with 11 test cases covering:

    • Basic anomaly detection scenarios
    • Extreme outlier cases
    • Null value handling for out-of-sample predictions
    • Edge cases (empty arrays, missing bounds, missing callbacks)
    • Real-world scenarios (gradual drift, sudden spikes, system failures)
    • Integration tests validating the complete fix

Before: Anomaly detection was essentially broken - would never detect
anomalies in real data when models produced good predictions
After: Anomaly detection works correctly, detecting actual anomalies
in original time series data regardless of model prediction quality

📦 Published PR as canary version: 0.5.1--canary.70.15561052406.0

✨ Test out this PR locally via:

npm install [email protected]
npm install [email protected]
npm install [email protected]
npm install @grafana/[email protected]
# or 
yarn add [email protected]
yarn add [email protected]
yarn add [email protected]
yarn add @grafana/[email protected]

@sd2k sd2k force-pushed the fix-baseliner-incorrect-detection branch from d330d04 to d4161cb Compare June 10, 2025 13:09
@sd2k sd2k changed the base branch from main to run-prettier June 10, 2025 13:09
Base automatically changed from run-prettier to main June 10, 2025 13:13
@sd2k sd2k force-pushed the fix-baseliner-incorrect-detection branch 2 times, most recently from 50e594c to 603aa82 Compare June 10, 2025 13:16
@sd2k sd2k marked this pull request as ready for review June 10, 2025 13:35
@sd2k sd2k added prerelease This change is available in a prerelease. patch Increment the patch version when merged release Create a release when this pr is merged labels Jun 10, 2025
Fixes #67 - SceneBaseliner anomaly detection was incorrectly comparing
model predictions against confidence intervals instead of comparing
original data against confidence intervals.

- **Fixed detectAnomalies()**: Now compares predictions vs bounds instead
  actual of vs bounds
- **Added null handling**: Properly skips out-of-sample predictions (null values)
- **Updated type signatures**: Support null values in originalValues array
- **Extracted testable function**: Made detectAnomalies() independently testable

- Added comprehensive test suite with 11 test cases covering:
  * Basic anomaly detection scenarios
  * Extreme outlier cases
  * Null value handling for out-of-sample predictions
  * Edge cases (empty arrays, missing bounds, missing callbacks)
  * Real-world scenarios (gradual drift, sudden spikes, system failures)
  * Integration tests validating the complete fix

Before: Anomaly detection was essentially broken - would never detect
anomalies in real data when models produced good predictions
After: Anomaly detection works correctly, detecting actual anomalies
in original time series data regardless of model prediction quality
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Increment the patch version when merged prerelease This change is available in a prerelease. release Create a release when this pr is merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SceneBaseliner anomaly detection checks against modeled baseline rather than original data

1 participant