random_sample_sparsifier#

Removes a given relative amount of samples from a signal.

class RandomSampleSparsifier(frac: Union[float, int] = 0.5)#

Bases: Sparsifier

Removes some relative amount of the given samples.

frac#

The relative amount of samples to keep from the incoming signal. 0 <= frac <= 1.

Raises:
  • TypeError – If frac is not a float.

  • ValueError – If frac not in the interval [0, 1].

Inits the RandomSampleSparsiier.

Parameters:

frac – The relative amount of samples to keep from the incoming signal.

sparsify(signal: DataFrame) DataFrame#

Removes some (1-frac) samples chosen with a uniform random distributions.

Parameters:

signal – The signal to sparsify.

Returns:

The sparsified signal.

Return type:

DataFrame