# Downsampling (downsample)¶

Downsampling reduces the number of frames in an observation sequence according to a specified downsample factor and one of two methods: averaging and decimation.

This is an especially helpful preprocessing method for speeding up classification times.

For further information, please see the preprocessing tutorial notebook.

## Example¶

 1 2 3 4 5 6 7 8 import numpy as np from sequentia.preprocessing import downsample # Create some sample data X = [np.random.random((10 * i, 3)) for i in range(1, 4)] # Downsample the data with downsample factor 5 and decimation X = downsample(X, n=5, method='decimate') 

## API reference¶

sequentia.preprocessing.downsample(X, 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: X: numpy.ndarray or List[numpy.ndarray] An individual observation sequence or a list of multiple observation sequences. n: int Downsample factor. method: {‘decimate’, ‘average’} The downsampling method. downsampled: numpy.ndarray or List[numpy.ndarray] The downsampled input observation sequence(s).