def time_series_has_duplicate_min(x): """ :param x: the time series to calculate the feature of :type x: pandas.Series :return: the value of this feature :return type: bool """ return ts_feature_calculators.has_duplicate_min(x)
def time_series_has_duplicate_min(x): """ Checks if the minimal value of x is observed more than once :param x: the time series to calculate the feature of :type x: pandas.Series :return: the value of this feature :return type: bool """ return ts_feature_calculators.has_duplicate_min(x)
def TS_features2(signal): duplicate = ts.has_duplicate(signal) # t.f duplicate_max = ts.has_duplicate_max(signal) # t.f duplicate_min = ts.has_duplicate_min(signal) # t.f kurtosis = ts.kurtosis(signal) longest_strike_above = ts.longest_strike_above_mean(signal) longest_strike_below = ts.longest_strike_below_mean(signal) return duplicate, duplicate_max, duplicate_min, kurtosis, longest_strike_above, longest_strike_below
def check_for_min_duplicate(mag): """Checks if the minimum value in mag repeats. 1 if True, 0 if False rtype: float """ check = str(ts.has_duplicate_min(mag)) if check == 'False': val = 0.0 else: val = 1.0 return val
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)) ])))