How to use the tsfresh.feature_extraction.feature_calculators.binned_entropy function in tsfresh

To help you get started, we’ve selected a few tsfresh examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Tencent / Metis / time_series_detector / feature / classification_features.py View on Github external
- \\sum_{k=0}^{min(max\\_bins, len(x))} p_k log(p_k) \\cdot \\mathbf{1}_{(p_k > 0)}

    where :math:`p_k` is the percentage of samples in bin :math:`k`.

    :param x: the time series to calculate the feature of
    :type x: pandas.Series
    :param max_bins: the maximal number of bins
    :type max_bins: int
    :return: the value of this feature
    :return type: float
    """
    max_bins = [2, 4, 6, 8, 10, 20]
    result = []
    for value in max_bins:
        result.append(ts_feature_calculators.binned_entropy(x, value))
    return result
github h2oai / driverlessai-recipes / transformers / signal_processing / signal_processing.py View on Github external
"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)
    for i_mf, val in enumerate(mfcc):
        sample['mfcc_%d' % i_mf] = val

    return sample,