pysindy.feature_library.ParameterizedLibrary
- class pysindy.feature_library.ParameterizedLibrary(parameter_library: BaseFeatureLibrary = PolynomialLibrary(degree=1), feature_library: BaseFeatureLibrary = PolynomialLibrary(), num_parameters: int = 3, num_features: int = 3)[source]
A tensor product of two libraries with different inputs. Typically, this is a feature library of the input data and a parameter library of input control, making the SINDyCP method. If the input libraries are weak, the temporal derivatives are automatically rescaled by the appropriate domain volumes.
- Parameters:
parameter_library (BaseFeatureLibrary, optional (default PolynomialLibrary).)
features. (Specifies the library function to apply to the input data)
feature_library (BaseFeatureLibrary, optional (default PolynomialLibrary).)
features.
num_parameters (int, optional (default 3))
control. (Specifies the number of features in the input)
num_features (int, optional (default 3))
data. (Specifies the number of features in the input)
- Attributes:
see GeneralizedLibrary
Examples
>>> import numpy as np >>> from pysindy.feature_library import ParameterizedLibrary,PolynomialLibrary >>> from pysindy import AxesArray >>> xs=[np.random.random((5,3)) for n in range(3)] >>> us=[np.random.random((5,3)) for n in range(3)] >>> feature_lib=PolynomialLibrary(degree=3) >>> parameter_lib=PolynomialLibrary(degree=1) >>> lib=ParameterizedLibrary(feature_library=feature_lib, >>> parameter_library=parameter_lib,num_features=3,num_parameters=3) >>> xus=[AxesArray(np.concatenate([xs[i],us[i]],axis=-1)) for i in range(3)] >>> lib.fit(xus) >>> lib.transform(xus)
Methods
calc_trajectoryConfigure whether metadata should be requested to be passed to the
fitmethod.Configure whether metadata should be requested to be passed to the
transformmethod.Attributes
n_features_in_n_output_features_- set_fit_request(*, x_full: bool | None | str = '$UNCHANGED$') ParameterizedLibrary
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_full (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for
x_fullparameter infit.- Returns:
self – The updated object.
- Return type:
object
- set_transform_request(*, x_full: bool | None | str = '$UNCHANGED$') ParameterizedLibrary
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_full (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for
x_fullparameter intransform.- Returns:
self – The updated object.
- Return type:
object