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

Bug in timeseries_anomalies function called regression_errors #148

Open
itinawi opened this issue Apr 2, 2019 · 0 comments
Open

Bug in timeseries_anomalies function called regression_errors #148

itinawi opened this issue Apr 2, 2019 · 0 comments
Labels
Pending Review The bug is not confirmed or the feature request is being considered

Comments

@itinawi
Copy link
Contributor

itinawi commented Apr 2, 2019

What I Did

I ran a pipeline with signal T-10 from the publicly available NASA Telemanom signal. My train/test split was 571 training samples and 24 testing samples. The code seems to be breaking because the span in ewm is int(len(y)*smoothing_window) = int(24*0.01) = int(0.24) = 0 which is less than 1. As per the pandas documentation span >= 1 (https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.ewm.html)

One way to fix this is to add a max(1, int(len(y)*smoothing_window)) so that we never go below 1 for the span.

Traceback:
Traceback (most recent call last):
  File "run_pipelines.py", line 76, in <module>
    anoms = pipeline.predict(test)
  File "/home/itinawi/meng/venv/lib/python3.5/site-packages/mlblocks/mlpipeline.py", line 264, in predict
    outputs = block.produce(**produce_args)
  File "/home/itinawi/meng/venv/lib/python3.5/site-packages/mlblocks/mlblock.py", line 268, in produce
    return self.primitive(**produce_args)
  File "/home/itinawi/meng/IML-private/Orion/analysis/timeseries_anomalies.py", line 33, in regression_errors
    return pd.Series(errors).ewm(span=smoothing_window).mean().values
  File "/home/itinawi/meng/venv/lib/python3.5/site-packages/pandas/core/generic.py", line 8927, in ewm
    adjust=adjust, ignore_na=ignore_na, axis=axis)
  File "/home/itinawi/meng/venv/lib/python3.5/site-packages/pandas/core/window.py", line 2489, in ewm
    return EWM(obj, **kwds)
  File "/home/itinawi/meng/venv/lib/python3.5/site-packages/pandas/core/window.py", line 2074, in __init__
    self.com = _get_center_of_mass(com, span, halflife, alpha)
  File "/home/itinawi/meng/venv/lib/python3.5/site-packages/pandas/core/window.py", line 2389, in _get_center_of_mass
    raise ValueError("span must satisfy: span >= 1")
ValueError: span must satisfy: span >= 1
@csala csala added the Pending Review The bug is not confirmed or the feature request is being considered label Apr 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pending Review The bug is not confirmed or the feature request is being considered
Projects
None yet
Development

No branches or pull requests

2 participants