Univariate Sine Wave#
- class oats.generator.univariate_wave.UnivariateWaveGenerator(stream_length: int, train_ratio: float = 0.2, behavior=<function _sine>, behavior_config: dict = {'coef': 1.5, 'freq': 0.04, 'noise_amp': 0.05, 'offset': 0.0})[source]#
Bases:
Generator
Generates a univariate signal and append anomalies as desired.
- train#
numpy array of generated train data
- test#
numpy array of generated test data
- label#
numpy array of labels
generator = UnivariateWaveGenerator(1000) generator.point_global_outliers(0.05, 2, 50) train, test, label = generator.get_dataset()
- Parameters:
stream_length (int) – Total length of train and test combined
train_ratio (float, optional) – Length of train relative to stream_length. Defaults to 0.2.
behavior (_type_, optional) – Underlying signal generating function. Defaults to sine.
behavior_config (dict, optional) – Default config for . Defaults to BEHAVIOR_CONFIG.
- collective_seasonal_outliers(ratio, factor, radius)[source]#
Add collective seasonal outliers to original data
- Parameters:
ratio – what ratio outliers will be added
factor – how many times will frequency multiple
radius – the radius of collective outliers range
- collective_shapelet_outliers(ratio, radius, option='square', coef=3.0, noise_amp=0.0, level=5, freq=0.04, offset=0.0, base=[0.0])[source]#
Add collective global outliers to original data
- Parameters:
ratio – what ratio outliers will be added
radius – the radius of collective outliers range
option – if ‘square’: ‘level’ ‘freq’ and ‘offset’ are used to generate square sine wave if ‘other’: ‘base’ is used to generate outlier shape
level – how many sine waves will square_wave synthesis
base – a list of values that we want to substitute inliers when we generate outliers
- collective_trend_outliers(ratio, factor, radius)[source]#
Add collective trend outliers to original data
- Parameters:
ratio – what ratio outliers will be added
factor – how dramatic will the trend be
radius – the radius of collective outliers range
- get_dataset()[source]#
- Returns:
numpy array of train data test: numpy array of test data label: numpy array of labels
- Return type:
train
- point_contextual_outliers(ratio, factor, radius)[source]#
Add point contextual outliers to original data
- Parameters:
ratio – what ratio outliers will be added
factor – the larger, the outliers are farther from inliers Notice: point contextual outliers will not exceed the range of [min, max] of original data
radius – the radius of collective outliers range