tspy.functions.transformers module¶
main entry point for all transformers (given time-series, return new time-series)
-
tspy.functions.transformers.
awgn
(mean=None, sd=None)¶ add noise using the following method https://en.wikipedia.org/wiki/Additive_white_Gaussian_noise
- Parameters
- meanfloat, optional
the mean around which to add the noise (default is time-series mean)
- sdfloat, optional
the standard deviation to use (default is time-series standard deviation)
- Returns
- ~tspy.data_structures.transforms.UnaryTransform
an additive-white-gaussian noise transform which, when applied on a time-series will add noise using the following method https://en.wikipedia.org/wiki/Additive_white_Gaussian_noise
-
tspy.functions.transformers.
combine_duplicate_time_ticks
(combine_strategy)¶ combine the observations which have the same time-tick
- Parameters
- combine_strategyfunc
a function or lamdba that receives one argument representing the collection of values of the same timestamp and returns a single value
- Returns
- ~tspy.data_structures.transforms.UnaryTransform
a combine-duplicate-time-ticks transform, which applied on a time-series will combine the observations which have the same time-tick
-
tspy.functions.transformers.
decompose
(samples_per_season, multiplicative)¶ get the residuals, trend, and seasonal components of a time-series
- Parameters
- samples_per_seasonint
number of samples in a season
- multiplicativebool
if True, use multiplicative method, otherwise use additive
- Returns
- ~tspy.data_structures.transforms.UnaryTransform
a decomposition transform, which applied on a time-series will result in the residuals, trend, and seasonal components
-
tspy.functions.transformers.
detect_anomalies
(forecasting_model, confidence, update_model=False, info=False)¶ filter for anomalies within the time-series given a forecasting model and its definition of confidence intervals
- Parameters
- forecasting_model~tspy.data_structures.forecasting.ForecastingModel
the forecasting model to use
- confidencefloat
a number between 0 and 1 (exclusive) which are used to determine the confidence interval
- update_modelbool, optional
if True, the model will be trained/updated (default is False)
- infobool, optional
if True, will give back the bounds/errors/expected values, otherwise no other information will be provided (default is False)
- Returns
- ~tspy.data_structures.transforms.UnaryTransform
an anomaly detection transform which, when applied on a time-series filter for anomalies within the time-series given a forecasting model and its definition of confidence intervals
-
tspy.functions.transformers.
difference
()¶ take the difference between the current observation value and its previous observation value
- Returns
- ~tspy.data_structures.transforms.UnaryTransform
a difference transform which, when applied on a numeric time-series will take the difference between the current observation value and its previous observation value
-
tspy.functions.transformers.
ema
(window)¶ smooth the time-series (x) such that the i^th observation on the transformed time-series z_i = lambda*x_i + (1-lambda)*z_i-1, where lambda - 1/window (window >= 1)
- Parameters
- windowint
window size
- Returns
- ~tspy.data_structures.transforms.UnaryTransform
a exponentially-weighted-moving-average transform, which applied on a time-series (x) will smooth the time-series such that the i^th observation on the transformed time-series z_i = lambda*x_i + (1-lambda)*z_i-1, where lambda - 1/window (window >= 1)
-
tspy.functions.transformers.
ljung_box
(window, step, num_lags, period)¶ test for the absence of serial correlation, up to a specified lag
- Parameters
- windowint
length of window
- stepint
number of steps
- num_lagsint
number of lags
- periodint
number to multiply the lag by when getting windows
- Returns
- ~tspy.data_structures.transforms.UnaryTransform
a ljung-box transform, which applied on a time-series will test for the absence of serial correlation, up to a specified lag
-
tspy.functions.transformers.
mwgn
(sd=None)¶ add noise given a standard-deviation
- Parameters
- sdfloat, optional
the standard deviation to use (default is time-series standard deviation)
- Returns
- ~tspy.data_structures.transforms.UnaryTransform
an multiplicative-white-gaussian noise transform which, when applied on a time-series will add noise given a standard-deviation
-
tspy.functions.transformers.
paa
(m)¶ approximate the time-series in a piecewise fashion. This is used to accelerate similarity measures between two time-series
- Parameters
- mint
num buckets
- Returns
- ~tspy.data_structures.transforms.UnaryTransform
a piecewise-aggregate-approximation transform, which applied on a time-series will approximate the time-series in a piecewise fashion. This is used to accelerate similarity measures between two time-series
-
tspy.functions.transformers.
remove_consecutive_duplicate_values
()¶ trim the time-series by removing consecutive duplicate values
- Returns
- ~tspy.data_structures.transforms.UnaryTransform
a remove-consecutive-duplicates transform, which applied on a time-series will trim the time-series by removing consecutive duplicate values
-
tspy.functions.transformers.
sax
(min_value, max_value, num_bins)¶ transform the time-series to a time-series of symbols by discretizing the value. Discretization is performed by uniformly dividing the values between min_value and max_value into num_bins bins
- Parameters
- min_valuefloat
min value
- max_valuefloat
max value
- num_binsint
number of bins
- Returns
- ~tspy.data_structures.transforms.UnaryTransform
a symbolic-aggregate-approximation transform, which applied on a time-series will transform the time-series to a time-series of symbols by discretizing the value
-
tspy.functions.transformers.
z_score
()¶ map each value to a number of standard deviations above/below the mean
- Returns
- ~tspy.data_structures.transforms.UnaryTransform
a Z-Normalization transform which, when applied on a numeric time-series will map each value to a number of standard deviations above/below the mean