Skip to content

Generate anomalies for sensor time series data

Notifications You must be signed in to change notification settings

cdknorow/anomaly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Anomaly is python library to help generate specific anomalies for time series data

The goal is to be able to introduce different types of anomalies that we believe will occur in our system to ensure that our outlier detection algorithms are able to pick them up. The anomaly package is designed to take raw timeseries data an perturb it in specific ways to help you generate syntehtic datasets with realistic anomalies specific to your use cases.

Lets start out with a simple example using the Anomaly object. Here we are going to set the anomaly locations at samples 300 and 700. We are going to guarantee they are generated by setting our anomaly rate to 1. We will only specify a single frequency_range, cycle_range and amplitude_range to begin with.

Note: This project is early alpha and API's may change

from anomay import Anomaly, shape, amplitudes
import numpy as np
import bqplot.pyplot as plt
import pandas as pd

a = Anomaly(frequency_range=[10,20,30], 
                cycle_range=[2,5],
                amplitude_range=[10, 50, 1000],
                anomaly_rate=.01,
                noise_range=[40, 20],
            anomaly_locations = None)

a.modify_signal(np.arange(0,1000), sample_rate=100))


a.set_shape(shape.Square)
a.set_adjust_amplitude(shape.Pyramid)


a.modify_signal(np.arange(0,1000), sample_rate=100))
fig = plt.figure(); fig.layout.width='100%'; plt.plot(data); fig

Anomaly 1

We can easily modify the shape and amplitude functions that are applied.

a.set_shape(shape.Sinusoidal)
a.set_adjust_amplitude(amplitudes.LinearSpike)

data = a.modify_signal(np.zeros(1000), sample_rate=100)
fig = plt.figure(); fig.layout.width='100%'; plt.plot(data); fig

Anomaly 2

For more in depth tutorial see the example notebooks.

About

Generate anomalies for sensor time series data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages