Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def time_series_absolute_sum_of_changes(x):
"""
Returns the sum over the absolute value of consecutive changes in the series x
.. math::
\\sum_{i=1, \ldots, n-1} \\mid x_{i+1}- x_i \\mid
:param x: the time series to calculate the feature of
:type x: pandas.Series
:return: the value of this feature
:return type: float
"""
return ts_feature_calculators.absolute_sum_of_changes(x)
def get_function(self):
return absolute_sum_of_changes
"autocorr1": feature_calculators.autocorrelation(sig, 1),
"autocorr2": feature_calculators.autocorrelation(sig, 2),
"autocorr3": feature_calculators.autocorrelation(sig, 3),
"autocorr5": feature_calculators.autocorrelation(sig, 5),
"autocorr10": feature_calculators.autocorrelation(sig, 10),
"autocorr_abs_01": feature_calculators.autocorrelation(x=np.abs(sig), lag=1),
"autocorr_abs_02": feature_calculators.autocorrelation(x=np.abs(sig), lag=2),
"autocorr_abs_03": feature_calculators.autocorrelation(x=np.abs(sig), lag=3),
"autocorr_abs_05": feature_calculators.autocorrelation(x=np.abs(sig), lag=5),
"autocorr_abs_10": feature_calculators.autocorrelation(x=np.abs(sig), lag=10),
# Trend error
"trend_stderr": feature_calculators.linear_trend(x=sig, param=[{"attr": "stderr"}])[0][1],
"abs_change": feature_calculators.absolute_sum_of_changes(x=sig),
"mean_change": np.mean(diff),
"ratio_diff": (diff[diff >= 0].sum() + eps) / (diff[diff < 0].sum() + eps),
"abs_energy": feature_calculators.abs_energy(x=sig - np.mean(sig)),
"agg_autocorr_mean":
feature_calculators.agg_autocorrelation(x=sig, param=[{"f_agg": "mean", "maxlag": 10}])[0][
1],
"agg_autocorr_std":
feature_calculators.agg_autocorrelation(x=sig, param=[{"f_agg": "std", "maxlag": 10}])[0][
1],
"agg_autocorr_abs_mean":
feature_calculators.agg_autocorrelation(x=np.abs(sig), param=[{"f_agg": "mean", "maxlag": 10}])[0][1],
"agg_autocorr_abs_std":
feature_calculators.agg_autocorrelation(x=np.abs(sig), param=[{"f_agg": "std", "maxlag": 10}])[0][1],
"binned_entropy": feature_calculators.binned_entropy(x=sig, max_bins=250),
"cid_ce_normed": feature_calculators.cid_ce(x=sig, normalize=True),