pyhctsa.robust.bf_remove_points

pyhctsa.robust.bf_remove_points(y, remove_how='absfar', p=0.1, remove_or_saturate='remove', random_seed=None)

Remove or saturate a proportion of the points of a time series (hctsa’s BF_RemovePoints).

Chooses a proportion, p, of the points of the (z-scored) series according to a rule, and either deletes them or clips their values. Removing deletes the chosen points and closes up the rest into a shorter series (in the original order). Saturating keeps them in place but clips their values to the most extreme value among the points kept. Used by hctsa’s DN_RemovePoints (order-free statistics of the changed series) and CO_RemovePoints (autocorrelation statistics of the changed series).

Parameters:
y : array-like

The input time series (should be z-scored).

remove_how : {'absclose', 'absfar', 'min', 'max', 'random'}, optional

How to choose the points to remove:

  • ’absclose’: those closest to the mean,

  • ’absfar’: those furthest from the mean (default),

  • ’min’: the lowest values,

  • ’max’: the highest values,

  • ’random’: at random.

p : float, optional

The proportion of points to remove. Default 0.1.

remove_or_saturate : {'remove', 'saturate'}, optional

Whether to remove the points (default) or to saturate their values (‘saturate’; possible for ‘absfar’, ‘min’ and ‘max’ only).

random_seed : int, 'default' or 'none', optional

Only relevant for remove_how='random': the seed of the random ordering (see bf_random_seed(); None or 'default' is seed 0, so the result is reproducible). The ordering is bf_random(N, seed, 'perm'), the portable generator, so it matches hctsa’s.

Returns:

The series after removing (a shorter series) or saturating (the original length) the chosen points.

Return type:

numpy.ndarray

Raises:

ValueError – For an unknown remove_how or remove_or_saturate, or saturating with a method that cannot be saturated.