Skip to content

Commit

Permalink
fix(anomaly-detection): Handle illegal padding amount (#1136)
Browse files Browse the repository at this point in the history
- Util raises exception if requested length for padding is less than
current mp_dist array

Note: is there a more graceful way to handle this?
  • Loading branch information
aayush-se committed Sep 9, 2024
1 parent c4e1979 commit bdf389f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/seer/anomaly_detection/detectors/mp_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ 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):
raise Exception(
"Requested length should be greater than or equal to current mp_dist"
)
nan_value_count = np.empty(pad_to_len - len(mp_dist))
nan_value_count.fill(np.nan)
mp_dist_updated = np.concatenate((nan_value_count, mp_dist))
Expand Down

0 comments on commit bdf389f

Please sign in to comment.