- last = list(t_data)[-1]
- t_stdev = list(t_data.rolling(window=win_size, min_periods=2).
- std())[-2]
- if isnan(last):
- classification = "outlier"
- last = list(pd_data)[-1]
- elif last < (trend - 3 * t_stdev):
+ t_data_lst = list(t_data)
+ stdev_lst = list(t_data.rolling(window=win_size, min_periods=2).
+ std())
+
+ rel_change_lst = [None, ]
+ classification_lst = [None, ]
+ for idx in range(1, len(trend_lst)):
+ # Relative changes list:
+ if not isnan(sample_lst[idx]) \
+ and not isnan(trend_lst[idx])\
+ and trend_lst[idx] != 0:
+ rel_change_lst.append(
+ int(relative_change(float(trend_lst[idx]),
+ float(sample_lst[idx]))))
+ else:
+ rel_change_lst.append(None)
+ # Classification list:
+ if isnan(t_data_lst[idx]) or isnan(stdev_lst[idx]):
+ classification_lst.append("outlier")
+ elif sample_lst[idx] < (trend_lst[idx] - 3*stdev_lst[idx]):
+ classification_lst.append("regression")
+ elif sample_lst[idx] > (trend_lst[idx] + 3*stdev_lst[idx]):
+ classification_lst.append("progression")
+ else:
+ classification_lst.append("normal")
+
+ last_idx = len(sample_lst) - 1
+ first_idx = last_idx - int(table["evaluated-window"])
+ if first_idx < 0:
+ first_idx = 0
+
+ if "regression" in classification_lst[first_idx:]: