linkedin / luminol

Anomaly Detection and Correlation library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error in AnomalyDetector instantiation

opened this issue · comments

I'm trying to run the Quick Start example, and in the very first command that instantiates a detector I get the following error:

ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

The command run is

detector = anomaly_detector.AnomalyDetector(ts)

Could this be caused by a change in the Pandas library?

I installed the last version of luminol, 0.3.1, with pip and I'm using Python 2.7.11 from the Anaconda distribution version 4.1.0 on Kubuntu 15.10.

This is the full traceback of the error:

<class 'pandas.core.series.Series'>
Traceback (most recent call last):
  File "open_heat_treatments.py", line 97, in <module>
    main()
  File "open_heat_treatments.py", line 90, in main
    detector = anomaly_detector.AnomalyDetector(ts)
  File "/home/dp/anaconda2/lib/python2.7/site-packages/luminol/anomaly_detector.py", line 44, in __init__
    self.time_series = self._load(time_series)
  File "/home/dp/anaconda2/lib/python2.7/site-packages/luminol/anomaly_detector.py", line 69, in _load
    if not time_series:
  File "/home/dp/anaconda2/lib/python2.7/site-packages/pandas/core/generic.py", line 892, in __nonzero__
    .format(self.__class__.__name__))
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

Pretty sure Luminol is expecting a time series in the form of a dictionary of time values -> numeric values or a Luminol.TimeSeries object

Try converting to a dict

It seems to be working great when using a dict, thank you very much!

(I also created a numeric index instead of using the datetime one, in case it helps anyone.)