constant_suffix_remover#
Provides a Sparsifier which removes constant suffixes.
- class ConstantSuffixRemover(n: int = 10, epsilon: float = 0.001, mode: str = 'relative')#
Bases:
SparsifierA sparsifier which removes constant suffixes.
- 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 ConstantSuffixRemover.
- Parameters:
n – The minimum length of the suffix to remove.
epsilon – Relative size of the epsilon-neighbourhood of the suffix.
mode – Wether the espilon neighborhood is “relative” or “absolute”.
- Raises:
TypeError – If n is not an int.
ValueError – If n is negative or epsilon is negative.
TypeError – If epsilon is neither float nor int.
ValueError – If mode is neither “absolute” nor “relative”.
- sparsify(signal: DataFrame) DataFrame#
Sparsifies the signal by constant suffixes.
- Parameters:
signal – The signal to sparsify.
- Returns:
The sparsified signal.