Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(anomaly_detection) Handle timeseries with very low variance #1186

Merged
merged 3 commits into from
Sep 23, 2024

Conversation

ram-senth
Copy link
Member

@ram-senth ram-senth commented Sep 21, 2024

This PR fixes two issues with anomaly detection logic with regards to time series with zero variance:

  • SuSS logic for window size selection fails
  • the interquartile range based scoring logic results in false positives

These two issues are fixed by

  • defaulting the window size to 3 if SuSS logic fails
  • using mean of a context window instead of IRQ for time series with low variance

It also includes additional changes to increase test coverage of anomaly detection code and additional tags to track frequency of low variance time series.

@ram-senth ram-senth force-pushed the anomaly-detection/low-variance-ts branch 10 times, most recently from c026200 to ddcdb56 Compare September 23, 2024 15:25
@ram-senth ram-senth force-pushed the anomaly-detection/low-variance-ts branch from ddcdb56 to eaf88a8 Compare September 23, 2024 15:45
Copy link
Member

@aayush-se aayush-se left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall code looks solid with good refactoring for variable names/datatypes as well. Tests also look good and cover a wide variety of cases.

Side note: for my nit on "IQR" vs "IRQ", I'll make a PR after this to adjust that as there are many instances of that throughout the code.

"""

variance_threshold: float = Field(
0.0001, description="Minimum variance required in order to use IRQ based scoring"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: isn't interquartile range usually shortened to "IQR"? I think IRQ refers to interrupt requests in hardware.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes indeed, it should be IQR :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have pushed the changes to rename IRQ to IQR.

@ram-senth ram-senth merged commit 777bbcf into main Sep 23, 2024
11 checks passed
@ram-senth ram-senth deleted the anomaly-detection/low-variance-ts branch September 23, 2024 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants