Browse Source

Anomaly detector: last NaN value #677

pull/1/head
Alexandr Velikiy 6 years ago committed by Evgeny Smyshlyaev
parent
commit
c1fc44ea10
  1. 6
      analytics/analytics/utils/common.py

6
analytics/analytics/utils/common.py

@ -32,8 +32,10 @@ def exponential_smoothing(series: pd.Series, alpha: float, last_smoothed_value:
result = [0] result = [0]
for n in range(1, len(series)): for n in range(1, len(series)):
if np.isnan(series[n]): if np.isnan(series[n]):
series[n] = 0 result.append((1 - alpha) * result[n - 1])
result.append(alpha * series[n] + (1 - alpha) * result[n - 1]) series.values[n] = result[n]
else:
result.append(alpha * series[n] + (1 - alpha) * result[n - 1])
return pd.Series(result, index = series.index) return pd.Series(result, index = series.index)
def find_pattern(data: pd.Series, height: float, length: int, pattern_type: str) -> list: def find_pattern(data: pd.Series, height: float, length: int, pattern_type: str) -> list:

Loading…
Cancel
Save