# Combined Preprocessing (Preprocess)¶

The Preprocess class provides a way of efficiently applying multiple preprocessing transformations to provided input observation sequences.

For further information, please see the preprocessing tutorial notebook.

## Example¶

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 import numpy as np from sequentia.preprocessing import Preprocess # Create some sample data X = [np.random.random((20 * i, 3)) for i in range(1, 4)] # Create the Preprocess object pre = Preprocess() pre.trim_zeros() pre.center() pre.standardize() pre.filtrate(n=5, method='median') pre.downsample(n=5, method='decimate') pre.fft() # View a summary of the preprocessing steps pre.summary() # Transform the data applying transformations in order X = pre.transform(X) 

## API reference¶

class sequentia.preprocessing.Preprocess[source]

Efficiently applies multiple preprocessing transformations to the provided input observation sequence(s).

trim_zeros(self)[source]

Trim zero-observations from the input observation sequence(s).

center(self)[source]

Centers an observation sequence (or multiple sequences) by centering observations around the mean.

standardize(self)[source]

Standardizes an observation sequence (or multiple sequences) by transforming observations so that they have zero mean and unit variance.

downsample(self, n, method='decimate')[source]

Downsamples an observation sequence (or multiple sequences) by either:

• Decimating the next $$n-1$$ observations
• Averaging the current observation with the next $$n-1$$ observations
Parameters: n: int Downsample factor. method: {‘decimate’, ‘average’} The downsampling method.
fft(self)[source]

Applies a Discrete Fourier Transform to the input observation sequence(s).

filtrate(self, n, method='median')[source]

Applies a median or mean filter to the input observation sequence(s).

Parameters: n: int Window size. method: {‘median’, ‘mean’} The filtering method.
transform(self, X)[source]

Applies the preprocessing transformations to the provided input observation sequence(s).

Parameters: X: numpy.ndarray or List[numpy.ndarray] An individual observation sequence or a list of multiple observation sequences. transformed: numpy.ndarray or List[numpy.ndarray] The input observation sequence(s) with preprocessing transformations applied in order.
summary(self)[source]

Displays an ordered summary of the preprocessing transformations.