Skip to content

Latest commit

 

History

History
191 lines (135 loc) · 5.8 KB

base-oscillations.md

File metadata and controls

191 lines (135 loc) · 5.8 KB

Base Oscillations

The generator comes with the following base oscillations in gutenTAG/base_oscillations:

  • sine
  • random-walk
  • cylinder-bell-funnel
  • ecg
  • polynomial
  • random-mode-jump
  • formula

Base oscillations can have an underlying trend. This trend can be any of the above base oscillations.

Using the variance property, you can add noise to the base oscillation. The general kind of base oscillation is always the same for all channels of a time series. However, noise and other random parameters differ between channels.

Common Parameters

Parameters for a new time series.

Name Type Description
name String Optional name for timeseries
length Int Length of entire time series
channels Int Number of dimensions
semi-supervised Bool Whether a train file without anomalies should be generated
supervised Bool Whether the train file should contain labels

These parameters can be set for all base oscillations.

Name Type Description
variance Float Noise factor dependent on amplitude
trend Object Defines another base oscillation as trend that gets added to its parent object. Can be recursively used!
offset Float Gets added to the generated time series

Sine

sine

Parameters

Name Type Description
frequency Float Number of sine waves per 100 points
amplitude Float +/- deviation from 0
freq-mod Float Factor (of base frequency) of the frequency modulation that changes the amplitude of the sine wave over time. The carrier wave always has an amplitude of 1.

Random Walk

rw

Parameters

Name Type Description
amplitude Float +/- deviation from 0
smoothing Float 0.01 Smoothing factor for convolution dependent on length

Cylinder Bell Funnel

cbf

Parameters

Name Type Description
avg-pattern-length Int Average length of pattern in time series
amplitude Float Average amplitude of pattern in time series
variance-pattern-length Float Variance of pattern length in time series
variance-amplitude Float Variance of amplitude of pattern in time series

ECG

ecg

Parameters

Name Type Description
frequency Float Number of hear beats per 100 points

Polynomial

polynomial

Parameters

Name Type Description
polynomial List[Float] Please see numpy documentation

Random Mode Jump

random-mode-jump

Parameters

Name Type Description
frequency Float Number of jumps in Time Series
channel_diff Float Value difference of absolute mode values between channels
channel_offset Float Value offset from 0 in both directions
random_seed Int Random seed to have the similar channels

Formula

Parameters

Name Type Description
base Int, Object Base time series to operate on.
operation Object Operation done on base object.
aggregation Object Aggregation done on base object.

The formula base oscillation is a simple math engine that can perform primitive math operations on multiple already generated channels.

Syntax

Formula Object

The FormulaObj is the base to every formula. It consists of three fields: base, operation, and aggregation. The base defines the first operand. It can either be a channel id (int) or another FormulaObj. The base can be the only field in a FormulaObj and then simply copies the channel with the right id (base:int). It can also have a field operation or aggregation. However, it cannot have both at the same time.

# FormulaObj
base: Union[int, FormulaObj]
operation: Optional[Operation]
aggregation: Optional[Aggregation]

Operation

The Operation is the vectorized math operation that is performed on the base. It consists of two required fields: kind, and operand. The kind field is an enum that defines which math operator to perform. The operand field is the operand that is calculated to the before-defined base. The operand can be a scalar value or another FormulaObj.

# Operation
kind: Enum[+, -, *, /, **]
operand: Union[float, FormulaObj]

Aggregation

The alternative to the Operation is the Aggregation field. This field defines an aggregation operation on the base. Its result is either a scalar or an array. It consists of two fields: kind, and axis. The kind field defines the kind of aggregation performed on a numpy array. The optional axis field defines the axis of the array the aggregation is performed on. If no axis is defined, the aggregation will return a scalar.

# Aggregation
kind: Enum[sum, min, max, median, std, var]
axis: Optional[int]

Example

The following formula:

import numpy as np
a = np.arange(10)
b = np.ones(10)
channels = [a, b]

# formula
(channels[0] + channels[0]) * channels[1].sum()

can be defined as the following FormulaObj:

formula:
  base:
    base: 0           # (channels[0]
    operation:
      kind: "+"       # +
      operand:
        base: 0       # channels[0])
  operation:
    kind: "*"         # *
    operand:
      base: 1         # channels[1]
      aggregation:
        kind: "sum"   # .sum()