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

feat(anomaly detection): Dynamic Window for Matrix Profiling #1451

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

aayush-se
Copy link
Member

@aayush-se aayush-se commented Nov 19, 2024

  • Use 2 windows (1 determined by the SuSS algorithm, and a "fixed" window at size 10) to perform detection reducing the recovery time for the algorithm ultimately making alerts persist for a shorter period of time after anomalous behavior is over
  • Performing detection twice for each window to maintain the matrix profiles
  • Updated the anomaly_algo_data to store matrix profile related information for both windows for a given alert
  • Created MPTimeSeriesAnomaliesSingleWindow class and updated the MPTimeSeriesAnomalies class to effectively manage and store the proper matrix profile related information and the boolean for determining which window logic to use
  • Updated current tests to match the new classes and their fields along with shapes for anomaly_algo_data

@aayush-se aayush-se requested a review from a team as a code owner November 19, 2024 00:22
@aayush-se
Copy link
Member Author

Waiting for codecov to give report -- will update test coverage upon receiving

if original_flag is None:
original_flag = "none"
original_flags.append(original_flag)
algo_data = MPTimeSeriesAnomalies.extract_algo_data(point.anomaly_algo_data)
Copy link
Member

Choose a reason for hiding this comment

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

Seems like this is not backward compatible as both mp_suss and mp_fixed are not there. So detection for existing alerts in production will fail, right?

Copy link
Member Author

@aayush-se aayush-se Nov 19, 2024

Choose a reason for hiding this comment

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

This was one thing I wanted to ask about -- if we were to use this class for prod, could we rerun calculation to populate the objects appropriately?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because to get the algo data for both suss and fixed, we would need to store the MP as a field in the object

Copy link
Member

@ram-senth ram-senth Nov 19, 2024

Choose a reason for hiding this comment

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

I think it will be best to just let the recalculation happen when data pruning happens. So this code should be backward compatible. We will need an unit test to check that. Also, test it locally with an alert pre-populated.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, will include those tests and confirm through local testing

convert_external_ts_to_internal(timeseries), config, window_size=window_size
)
anomalies_fixed = batch_detector.detect(
convert_external_ts_to_internal(timeseries), config, window_size=10
Copy link
Member

Choose a reason for hiding this comment

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

We should add this 10 as a constant to the MPConfig class?

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