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_abs_energy(x):
"""
Returns the absolute energy of the time series which is the sum over the squared values
.. math::
E = \\sum_{i=1,\ldots, n} x_i^2
: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.abs_energy(x)
"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),
}
mfcc = librosa.feature.mfcc(sig.astype(np.float64) - the_mean, n_mfcc=mfcc_size).mean(axis=1)
As in tsfresh `abs_energy `_ \
Returns the absolute energy of the time series which is the sum over the squared values\
.. math::
E=\\sum_{i=1,\ldots, n}x_i^2
:param x: the time series to calculate the feature of
:type x: pandas.Series
:return: the value of this feature
:rtype: float
"""
_energy = feature_calculators.abs_energy(x)
logging.debug("abs energy by tsfresh calculated")
return _energy
def get_function(self):
return abs_energy