pyhctsa.operations.pre_process.preproc_iterate

pyhctsa.operations.pre_process.preproc_iterate(y, dt_meth='diff')

How time-series properties change as a preprocessing step is applied more and more strongly.

A preprocessing transformation is applied to the time series with increasing strength (for the number of times, or the window size, given by the method), and a set of statistics is computed on the (z-scored) processed series at each strength. Each statistic’s profile across the strengths is then z-scored and summarized by a trend (the sum of its successive differences, i.e., the last minus the first value) and a jump (the largest t-statistic for a step change in the mean, over all split points).

Parameters:
y : array-like

The input time series.

dt_meth : str, optional

The preprocessing to apply:

  • "spline": remove a least-squares cubic spline with 1, …, 20 pieces

  • "diff": take incremental differences, 1, …, 5 times (the method hctsa uses)

  • "medianf": a median filter with 25 window lengths from 1 to N/25

  • "rav": a running mean filter with 25 window lengths from 1 to N/25

  • "resampleup": progressively upsample the series, by factors 1, …, 20

  • "resampledown": progressively downsample the series, by factors 1, …, 20

Default is "diff".

Returns:

For each of the following statistics, measured on the processed series at each strength, a trend (key ending _trend) and a jump (ending _jump) of its profile across the strengths:

  • statav5: StatAv with 5 segments (stat_av)

  • swms5_2: the standard deviation of the window means in 5 windows overlapping by half

  • swss5_2: the standard deviation of the window standard deviations in 5 windows overlapping by half, relative to that of the original series

  • gauss1_kd: the root-mean-square error of a Gaussian fit to the kernel-smoothed distribution of values

  • gauss1_hsqrt: the root-mean-square error of a Gaussian fit to a histogram of the values (square-root rule for the number of bins)

  • norm_kscomp: the area between the kernel-smoothed distribution of the values and the best-fitting normal distribution (compare_ks_fit)

  • ol: the mean after trimming the 5% highest and 5% lowest values (outlier_test)

  • xcn1, xc1: the cross-correlation between the original and processed series at lags -1 and +1

  • normdiff: the distance between the original and processed series, norm(y - y_processed) / N

The last three statistics need the processed series to be as long as the original, so they are NaN for 'diff' and the resampling methods. All outputs are NaN if, at any strength, the processed series has no variation beyond floating-point round-off (a standard deviation of at most 10*N*eps times the root-mean-square of the original, a bound on the rounding error of the processing; as in preproc_compare()), as statistics of round-off are not meaningful. Small but genuine variation is computed.

Return type:

dict