def time_series_standard_deviation(x): """ :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.standard_deviation(x)
def TS_features12(signal): stand_deviation = ts.standard_deviation(signal) sum_reoccurring = ts.sum_of_reoccurring_data_points(signal) sum_r_value = ts.sum_of_reoccurring_values(signal) sum_v = ts.sum_values(signal) variance = ts.variance(signal) variance_larger_than_sd = ts.variance_larger_than_standard_deviation( signal) return stand_deviation, sum_reoccurring, sum_r_value, sum_v, variance, variance_larger_than_sd
def extract_feats(ts): std = fc.standard_deviation(ts) kurtosis = fc.kurtosis(ts) skewness = fc.skewness(ts) cam = fc.count_above_mean(ts) cbm = fc.count_below_mean(ts) lsam = fc.longest_strike_above_mean(ts) lsbm = fc.longest_strike_below_mean(ts) psd = fc.fourier_entropy(ts, bins=1000000) energy = fc.abs_energy(ts) return np.array( [std, kurtosis, skewness, cam, cbm, lsam, lsbm, psd, energy])
def extract_features(data): day = 24 * 60 return list( numpy.nan_to_num( numpy.array([ feature.symmetry_looking(data, [{ 'r': 0.3 }])[0][1], feature.variance_larger_than_standard_deviation(data).bool(), feature.ratio_beyond_r_sigma(data, 2), feature.has_duplicate_max(data), feature.has_duplicate_min(data), feature.has_duplicate(data), feature.agg_autocorrelation(numpy.array(data.value), [{ 'f_agg': 'mean', 'maxlag': day }])[0][1], feature.partial_autocorrelation(data, [{ 'lag': day }])[0][1], feature.abs_energy(numpy.array(data.value)), feature.mean_change(data), feature.mean_second_derivative_central(data), feature.median(data), float(feature.mean(data)), float(feature.standard_deviation(data)), float(feature.longest_strike_below_mean(data)), float(feature.longest_strike_above_mean(data)), int(feature.number_peaks(data, 10)), feature.linear_trend(numpy.array(data.value), [{ 'attr': 'rvalue' }])[0][1], feature.c3(data, day), float(feature.maximum(data)), float(feature.minimum(data)) ])))
def get_sd(arr): res = np.array([standard_deviation(arr)]) res = np.nan_to_num(res) return res