Centering (Center)

API reference

class sequentia.preprocessing.Center(independent=True)[source]

Centers the observation sequence features around their means. Results in zero-mean features.

Parameters
independent: bool

Whether to independently compute the mean to scale each observation sequence.

Examples

>>> # Create some sample data
>>> X = [np.random.random((10 * i, 3)) for i in range(1, 4)]
>>> # Center the data
>>> X = Center()(X)
fit(X, validate=True)[source]

Fit the transformation on the provided observation sequence(s) (without transforming them).

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

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

validate: bool

Whether or not to validate the input sequences.

transform(x)[source]

Applies the transformation to a single observation sequence.

Parameters
X: numpy.ndarray (float)

An individual observation sequence.

Returns
transformed:class:numpy:numpy.ndarray (float)

The transformed input observation sequence.

is_fitted()[source]

Check whether or not the transformation is fitted on some observation sequence(s).

Returns
fitted: bool

Whether or not the transformation is fitted.

unfit()[source]

Unfit the transformation by resetting the parameters to their default settings.

fit_transform(X, validate=True)

Fit the transformation 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.

validate: bool

Whether or not to validate the input sequences.

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

The transformed input observation sequence(s).

__call__(X, validate=True)

Applies the transformation to the 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.

validate: bool

Whether or not to validate the input sequences.

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

The transformed input observation sequence(s).