pysindy.feature_library.base.BaseFeatureLibrary
- class pysindy.feature_library.base.BaseFeatureLibrary[source]
Base class for feature libraries.
Forces subclasses to implement
fit,transform, andget_feature_namesmethods.Methods
calc_trajectoryCorrect the shape of x, given what we know of the problem
Compute number of output features.
Return feature names for output features.
get_spatial_gridAdapt predictions to fitted spatial grid.
Configure whether metadata should be requested to be passed to the
fitmethod.Configure whether metadata should be requested to be passed to the
transformmethod.Transform data.
validate_inputAttributes
sizen_features_in_n_output_features_- abstractmethod fit(x, y=None)[source]
Compute number of output features.
- Parameters:
x (array-like, shape (n_samples, n_features)) – The data.
- Returns:
self
- Return type:
instance
- abstractmethod get_feature_names(input_features=None) list[str][source]
Return feature names for output features.
- Parameters:
input_features (list of string, length n_features, optional) – String names for input features if available. By default, “x0”, “x1”, … “xn_features” is used.
- Returns:
output_feature_names
- Return type:
list of string, length n_output_features
- reshape_samples_to_spatial_grid(x: ndarray) AxesArray[source]
Adapt predictions to fitted spatial grid.
- set_fit_request(*, x: bool | None | str = '$UNCHANGED$') BaseFeatureLibrary
Configure whether metadata should be requested to be passed to the
fitmethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed tofitif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it tofit.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
- Parameters:
x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for
xparameter infit.- Returns:
self – The updated object.
- Return type:
object
- set_transform_request(*, x: bool | None | str = '$UNCHANGED$') BaseFeatureLibrary
Configure whether metadata should be requested to be passed to the
transformmethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed totransformif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it totransform.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
- Parameters:
x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for
xparameter intransform.- Returns:
self – The updated object.
- Return type:
object
- abstractmethod transform(x)[source]
Transform data.
- Parameters:
x (array-like, shape [n_samples, n_features]) – The data to transform, row by row.
- Returns:
xp – The matrix of features, where n_output_features is the number of features generated from the combination of inputs.
- Return type:
np.ndarray, [n_samples, n_output_features]