tspy.functions.reducers module¶
main entry point for all time-series reducers (given segment, return value)
Notes¶
if used on a segment-time-series, you must call transform as the output will be a time-series.
if used on a non-segment-time-series, you must call reduce as the output will be a single value.
-
tspy.functions.reducers.
adf
(lag=None, p_value=- 3.45)¶ test the null hypothesis that a unit root is present in a time-series sample
- Parameters
- lagint, optional
the lag (default is floor(cubed_root(size-1)))
- p_valuefloat, optional
the adf p-value threshold, generally a p-value of less than 5% means you can reject the null hypothesis (default is -3.45)
- Returns
- unary-reducer
an augmented-dickey-fuller-test reducer, which applied on a time-series or segment, will test the null hypothesis that a unit root is present in a time-series sample
-
tspy.functions.reducers.
auto_correlation
()¶ result in the auto-correlation at all lags
- Returns
- unary-reducer
an auto-correlation unary-reducer, which applied on a time-series or segment will result in the auto-correlation at all lags
-
tspy.functions.reducers.
average
()¶ result in the average of all values
- Returns
- unary-reducer
an average unary-reducer, which applied on a time-series or segment will result in the average of all values
-
tspy.functions.reducers.
convolve
()¶
-
tspy.functions.reducers.
correlation
()¶ result in the correlation value between both time-series/segments
- Returns
- binary-reducer
a correlation binary-reducer, which applied on two time-series or segments will result in the correlation value between both time-series/segments
-
tspy.functions.reducers.
count_by_value
()¶ produce a dict of counts of each unique value in the time-series
- Returns
- unary-reducer
a count_by_value reducer, which applied on a time-series or segment will return a dict of counts of each unique value in the time-series
-
tspy.functions.reducers.
cross_correlation
()¶ result in the cross correlation values (array) between both time-series/segments
- Returns
- binary-reducer
a cross-correlation binary-reducer, which applied on two time-series or segments will result in the cross correlation values (array) between both time-series/segments
-
tspy.functions.reducers.
describe
()¶ result in the basic components of the time-series (~tspy.data_structures.Stats.Stats)
- Returns
- unary-reducer
a describe reducer, which applied on a time-series will return the basic components of the time-series (~tspy.data_structures.Stats.Stats)
-
tspy.functions.reducers.
distance_correlation
()¶
-
tspy.functions.reducers.
distance_covariance
()¶
-
tspy.functions.reducers.
distance_variance
()¶
-
tspy.functions.reducers.
dl
(func)¶ perform the dl distance
- Parameters
- funcfunc
a function which given two values, will return a bool for whether the values match
- Returns
- binary-reducer
a demerau-levenstein distance reducer, which applied on two time-series or segments, will perform the dl distance
-
tspy.functions.reducers.
dtw
(func)¶ calculate the dtw distance of two time-series of varying speed
- Parameters
- funcfunc
a function which given two values, will return a value representing the distance
- Returns
- binary-reducer
a dynamic-time-warped distance reducer, which applied on two time-series or segments, will calculate the dtw distance of two time-series of varying speed
-
tspy.functions.reducers.
entropy
()¶ calculate the entropy (average level of uncertainty)
- Returns
- unary-reducer
a entropy reducer, which applied on a time-series will return the entropy (average level of uncertainty)
-
tspy.functions.reducers.
fft
()¶ result in a vector representing the frequency content from fft
- Returns
- unary-reducer
an fft unary-reducer, which applied on a time-series or segment will result in a vector representing the frequency content
-
tspy.functions.reducers.
granger
(lag)¶ test whether one time-series is useful in forecasting another
- Parameters
- lagint
lag of the other time-series with respect to the calling time-series
- Returns
- binary-reducer
a granger-causality-test reducer, which applied on two time-series or segments, will test whether one time-series is useful in forecasting another
-
tspy.functions.reducers.
histogram
(min, max, num_divisions, normalize=False)¶ bucket values based on their place with the given range (min/max)
- Parameters
- minfloat
lower bound for buckets
- maxfloat
upper bound for buckets
- num_divisionsint
number of buckets to return
- normalizebool, optional
if True, will normalize the bucket values, otherwise bucket values will be counts
- Returns
- unary-reducer
a histogram reducer, which applied on a time-series or segment will bucket values based on their place with the given range (min/max)
-
tspy.functions.reducers.
itakura_parralelogram_dtw
(func, constraint, center_offset_percentage)¶ todo
-
tspy.functions.reducers.
kurtosis
()¶ result in the kurtosis (a measure of whether the values in the series are heavy-tailed or light tailed relative to normal distribution)
- Returns
- unary-reducer
a kurtosis reducer, which applied on a time-series or segment will result in the kurtosis (a measure of whether the values in the series are heavy-tailed or light tailed relative to normal distribution)
-
tspy.functions.reducers.
manhattan
(func)¶ calculate the point-wise manhattan distance
- Parameters
- funcfunc
a function which given two values, will return a value representing the distance
- Returns
- binary-reducer
a simple manhattan distance reducer, which applied on two time-series or segments, will calculate the point-wise manhattan distance
-
tspy.functions.reducers.
max
()¶ result in the max of the values
- Returns
- unary-reducer
a max reducer, which applied on a time-series or segment will result in the max of the values
-
tspy.functions.reducers.
min
()¶ result in the min of the values
- Returns
- unary-reducer
a min reducer, which applied on a time-series or segment will result in the min of the values
-
tspy.functions.reducers.
mutual_information
()¶
-
tspy.functions.reducers.
percentile
(quantile)¶ result in the percentile of the values given a quantile
- Parameters
- quantiledouble
the quantile to compute percentile at
- Returns
- unary-reducer
a percentile reducer, which applied on a time-series or segment will result in the percentile of the values given a quantile
-
tspy.functions.reducers.
sakoe_chiba_dtw
(func, constraint)¶ todo
-
tspy.functions.reducers.
sbd
()¶ calculate a distance based on time-series shape
- Returns
- binary-reducer
a shape-based distance reducer, which applied on two time-series or segments, will calculate a distance based on time-series shape
-
tspy.functions.reducers.
skewness
()¶ result in the skewness (a measure of symmetry)
- Returns
- unary-reducer
a skewness reducer, which applied on a time-series or segment will result in the skewness (a measure of symmetry)
-
tspy.functions.reducers.
standard_deviation
()¶ result in the standard-deviation computation
- Returns
- unary-reducer
a standard-deviation-reducer, which applied on a time-series or segment will result in the standard-deviation computation
-
tspy.functions.reducers.
sum
()¶ result in the sum of all values
- Returns
- unary-reducer
a sum unary-reducer, which applied on a time-series or segment will result in the sum of all values