pyhctsa.robust.bf_tie_break_noise

pyhctsa.robust.bf_tie_break_noise(y, seed=0)

Add tiny, reproducible jitter to break exact ties in y (hctsa BF_TieBreakNoise).

y is returned unchanged unless it has a high proportion of repeated values (fewer than 90% of its values unique), in which case Gaussian noise of standard deviation 1e-10 * std(y) is added: small enough to leave a well-behaved continuous series untouched, but enough to break the exact ties that make nearest-neighbor (Kraskov/KSG) mutual-information estimators degenerate on quantized or periodic-orbit data.

The noise is bf_random(numel(y), seed, 'normal'), so the same input always gives the same output and NumPy’s global random state is not consumed.

Parameters:
y : array-like

The input vector (or matrix; the repeat test and noise scale use all elements; the noise fills a matrix in column-major order).

seed : int, optional

Seed of the bf_random stream (default 0). Use different seeds for different variables that will be jittered and then compared to one another.

Returns:

The (possibly) jittered input, same shape.

Return type:

numpy.ndarray