Beispiel #1
0
def time_series_has_duplicate_max(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_max(x)
Beispiel #2
0
def time_series_has_duplicate_max(x):
    """
    Checks if the maximum 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_max(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 check_for_max_duplicate(mag):
    """Checks if the maximum value in mag repeats.
    1 if True, 0 if False

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