zrnsm / pyculiarity

A Python port of Twitter's AnomalyDetection R Package
GNU General Public License v3.0
364 stars 146 forks source link

how do I plot the output as shown on the official R implementation #15

Open abhishekscript opened 7 years ago

abhishekscript commented 7 years ago

The code worked however I am not sure how do I plot something like this from the results

image

nth-attempt commented 6 years ago
from pyculiarity import detect_ts
import pandas as pd
twitter_example_data = pd.read_csv('raw_data.csv',
                                    usecols=['timestamp', 'count'])
results = detect_ts(twitter_example_data,
                    max_anoms=0.02,
                    direction='both')

plt.plot(twitter_example_data['timestamp'], twitter_example_data['value'])
plt.plot(results['anoms'].anoms, 'o')