adtk is the anomaly detection module.
This is unsupervised rule-based anomaly detection in time series.
This is what my graph will look like in most cases.
import pandas as pd
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
% matplotlib online
rand = np.random.RandomState (123)
s = pd.Series (
np.cumsum (rand.normal (size = 300)),
index = pd.date_range (start = “2017-1-1”, periods = 300, freq = “D”),
)
plt.plot (s)
In order to find and plot outliers, I will only need 4 lines of code.
from the adtk.visualization import plot
import adtk.detector as detector
anomaly = detector.QuantileAD (low = 0.05, high = 0.95) .fit_detect (s, return_list = False)
plot (s, anomaly)
#pip install adtk
Labels: machine_learning