nemos.basis._transformer_basis.TransformerBasis.fit_transform#

TransformerBasis.fit_transform(X, y=None)[source]#

Compute the kernels and the features.

This method is a convenience that combines fit and transform into one step.

Parameters:
  • X (TsdFrame | ndarray[tuple[int, ...], dtype[TypeVar(_ScalarType_co, bound= generic, covariant=True)]]) – The data to fit the basis functions to and then transform.

  • y – Not used, present for API consistency by convention.

Returns:

The data transformed by the basis functions, after fitting the basis functions to the data.

Return type:

array-like

Examples

>>> import numpy as np
>>> from nemos.basis import MSplineEval, TransformerBasis
>>> # Example input
>>> X = np.random.normal(size=(100, 1))
>>> # Define tranformation basis
>>> basis = MSplineEval(10).set_input_shape(1)
>>> transformer = TransformerBasis(basis)
>>> # Fit and transform basis
>>> feature_transformed = transformer.fit_transform(X)