-
-
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
fix(anomaly-detection): Handle illegal padding amount #1136
Conversation
@@ -42,6 +42,8 @@ def get_mp_dist_from_mp( | |||
mp_dist = normalizer.normalize(mp_dist) | |||
|
|||
if pad_to_len is not None: | |||
if pad_to_len - len(mp_dist) < 0: |
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.
Minor nit: len(mp_dist) <= pad_to_len
would be a little bit more readable?
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 dont think it should be equal since that just means no padding is added
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.
Yes you are right. So we should raise error if pad_to_len is less than or equal to len(mp_len).
- Generated Synthetic timeseries (cyclical, cyclical with anomaly, noisy, noisy with anomaly) to use for unit and integration tests - Timeseries generated in`data-analysis` GitHub repo - Wrote unit tests for the following modules in anomaly_detection: - Detectors - `anomaly_detectors.py` - `mp_config.py` - `mp_scorers.py` - `mp_utils.py` - `normalizers.py` - `window_size_selctors.py` - Models - `converters.py` - `timeseries_anomalies.py` - `timeseries.py` Wrote integration tests for the `store` and `detect` endpoints for batch, stream, and combo pipelines **NOTE:** Wanted to submit this PR to start getting some feedback as there are a lot of changes. As of submitting this PR, the following unit/integration tests do not work and I wanted to get some feedback: - `test_detect_anomalies_online` in `test_anomaly_detection.py`: Was unsure how to handle database changes during integration test - `test_detect` in `test_anomaly_detectors.py`: was running into shape errors with the matrix profile - `test_incorrect_padding` in `test_mp_utils.py`: this one is fixed as of [this PR](#1136) so needs to be merged into main to reflect changes --------- Co-authored-by: sentry-autofix-experimental[bot] <157164994+sentry-autofix-experimental[bot]@users.noreply.github.com> Co-authored-by: jenn.muengtaweepongsa <jenn.muengtaweepongsa@sentry.io> Co-authored-by: Rohan Agarwal <47861399+roaga@users.noreply.github.com> Co-authored-by: Jenn Mueng <30991498+jennmueng@users.noreply.github.com> Co-authored-by: Rohan Agarwal <rohan.agarwal@sentry.io> Co-authored-by: Ram Senthamarai <ram-senth@users.noreply.github.com>
Note: is there a more graceful way to handle this?