nemos.basis._transformer_basis.TransformerBasis.transform#
- TransformerBasis.transform(X, y=None)[source]#
Transform the data using the fitted basis functions.
- Parameters:
X (
TsdFrame
|ndarray
[tuple
[int
,...
],dtype
[TypeVar
(_ScalarType_co
, bound=generic
, covariant=True)]]) – The data to transform using the basis functions, shape (num_samples, num_input).y – Not used, present for API consistency by convention.
- Return type:
TsdFrame
|ndarray
[tuple
[int
,...
],dtype
[TypeVar
(_ScalarType_co
, bound=generic
, covariant=True)]]- 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)