nemos.basis._transformer_basis.TransformerBasis.transform#
- TransformerBasis.transform(X, y=None)[source]#
Transform the data using the fitted basis functions.
- Parameters:
- Return type:
TsdFrame|ndarray[tuple[Any,...],dtype[TypeVar(_ScalarT, bound=generic)]]- Returns:
The data transformed by the basis functions.
Examples
>>> import numpy as np >>> from nemos.basis import MSplineConv, TransformerBasis
>>> # Example input >>> X = np.random.normal(size=(10000, 2))
>>> basis = MSplineConv(10, window_size=200).set_input_shape(2) >>> transformer = TransformerBasis(basis) >>> # Before calling `fit` the convolution kernel is not set >>> transformer.kernel_
>>> transformer_fitted = transformer.fit(X) >>> # Now the convolution kernel is initialized and has shape (window_size, n_basis_funcs) >>> transformer_fitted.kernel_.shape (200, 10)
>>> # Transform basis >>> feature_transformed = transformer.transform(X)