Combined Preprocessing (Compose)

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

For further information, please see the preprocessing tutorial notebook.

API reference

class sequentia.preprocessing.Compose(steps)[source]

A pipeline of preprocessing transformations.

Parameters
steps: array-like of Transform

An ordered collection of preprocessing transformations.

Examples

>>> # Create some sample data
>>> X = [np.random.random((20 * i, 3)) for i in range(1, 4)]
>>> # Create the Compose object
>>> pre = Compose([
>>>     TrimConstants(),
>>>     Center(),
>>>     Standardize(),
>>>     Filter(window_size=5, method='median'),
>>>     Downsample(factor=5, method='decimate')
>>> ])
>>> # View a summary of the preprocessing steps
>>> pre.summary()
>>> # Transform the data applying transformations in order
>>> X = pre(X)
__call__(X)[source]

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

Parameters
X: numpy.ndarray (float) or list of numpy.ndarray (float)

An individual observation sequence or a list of multiple observation sequences.

Returns
transformed:class:numpy:numpy.ndarray (float) or list of numpy.ndarray (float)

The input observation sequence(s) with preprocessing transformations applied in order.

fit(X)[source]

Fit the preprocessing transformations with the provided observation sequence(s).

Parameters
X: numpy.ndarray (float) or list of numpy.ndarray (float)

An individual observation sequence or a list of multiple observation sequences.

fit_transform(X)[source]

Fit the preprocessing transformations with the provided observation sequence(s) and transform them.

Parameters
X: numpy.ndarray (float) or list of numpy.ndarray (float)

An individual observation sequence or a list of multiple observation sequences.

Returns
transformed:class:numpy:numpy.ndarray (float) or list of numpy.ndarray (float)

The input observation sequence(s) with preprocessing transformations applied in order.

summary()[source]

Displays an ordered summary of the preprocessing transformations.