-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: main
Are you sure you want to change the base?
Conversation
cc46826
to
bf302c1
Compare
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
66e45c6
to
29d9139
Compare
and "mp_suss" not in timeseries[-1].anomaly_algo_data | ||
and "mp_fixed" not in timeseries[-1].anomaly_algo_data | ||
): | ||
timeseries = self._recalculate_batch_detection(db_alert) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we recalculate but we do not save to the database here. However, the new time step that will be stored in the db will have these additional information. So next detect call will actually fail, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Within _recalculate_batch_detection
, another function update_timeseries
is called that directly updates the DbDynamicAlertTimeSeries with the new anomaly_algo_data
I'm good with the changes. Just wanted to confirm that you tested locally with a saved alert that does not have the fixed window history to confirm the backward compatibility. We do not want production failures when we deploy. Also, seems like the unit test coverage needs increasing. There are a few low hanging fruits like testing for length mismatch etc that should take it over the goal. |
anomaly_algo_data
to store matrix profile related information for both windows for a given alertMPTimeSeriesAnomaliesSingleWindow
class and updated theMPTimeSeriesAnomalies
class to effectively manage and store the proper matrix profile related information and the boolean for determining which window logic to useMPTimeSeriesAnomalies
classanomaly_algo_data