pyculiarity icon indicating copy to clipboard operation
pyculiarity copied to clipboard

ValueError: Anom detection needs at least 2 periods worth of data

Open inder-preet-kakkar opened this issue 5 years ago • 1 comments

I was trying detect_ts with the following parameters; max_anoms=0.1, direction='both', alpha=0.02, longterm=True

It seems to call detect_anoms with lesser data than required. Also my data is of 15 min resolution with a daily seasonality (from Fourier Transform), this might have to do with the way you are assigning the period in your program.


ValueError Traceback (most recent call last) in () 6 7 results = detect_ts(pd.DataFrame({'time':full_data.index.values, 'values':full_data.metric_value.values}), ----> 8 max_anoms=0.1, direction='both', alpha=0.02, longterm=True)

c:\users\inder\desktop\sonalake\pyculiarity\pyculiarity\detect_ts.py in detect_ts(df, max_anoms, direction, alpha, only_last, threshold, e_value, longterm, piecewise_median_period_weeks, plot, y_log, xlabel, ylabel, title, verbose) 223 one_tail=anomaly_direction.one_tail, 224 upper_tail=anomaly_direction.upper_tail, --> 225 verbose=verbose) 226 227 # store decomposed components in local variable and overwrite

c:\users\inder\desktop\sonalake\pyculiarity\pyculiarity\detect_anoms.py in detect_anoms(data, k, alpha, num_obs_per_period, use_decomp, one_tail, upper_tail, verbose) 39 # Check to make sure we have at least two periods worth of data for anomaly context 40 if num_obs < num_obs_per_period * 2: ---> 41 raise ValueError("Anom detection needs at least 2 periods worth of data") 42 43 # Check if our timestamps are posix

ValueError: Anom detection needs at least 2 periods worth of data

inder-preet-kakkar avatar Mar 05 '19 16:03 inder-preet-kakkar

just give more data, and retry

cjen07 avatar Jun 28 '20 03:06 cjen07