Beispiel #1
0
def time_series_has_duplicate(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(x)
Beispiel #2
0
def time_series_has_duplicate(x):
    """
    Checks if any value in x occurs 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(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
Beispiel #4
0
def time_series_has_duplicate(x):
    """
    序列x是否存在重复值,存在为false,否则为true
    Checks if any value in x occurs 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: int
    """
    return ts_feature_calculators.has_duplicate(x)
Beispiel #5
0
def check_for_duplicate(mag):
    """Checks if any val in mag repeats.
    1 if True, 0 if False

    rtype: int
    """
    check = str(ts.has_duplicate(mag))
    if check == 'False':
        val = 0.0
    else:
        val = 1.0
    return val
Beispiel #6
0
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))
            ])))