pysindy.deeptime.SINDyEstimator
- class pysindy.deeptime.SINDyEstimator(optimizer=None, feature_library=None, differentiation_method=None)[source]
Implementation of SINDy conforming to the API of a Deeptime Estimator.
- Parameters:
optimizer (optimizer object, optional) – Optimization method used to fit the SINDy model. This must be an object extending
pysindy.optimizers.BaseOptimizer. Default is sequentially thresholded least squares with a threshold of 0.1.feature_library (feature library object, optional) – Feature library object used to specify candidate right-hand side features. This must be an object extending the
pysindy.feature_library.base.BaseFeatureLibrary. Default is polynomial features of degree 2.differentiation_method (differentiation object, optional) – Method for differentiating the data. This must be an object extending the
pysindy.differentiation_methods.base.BaseDifferentiationclass. Default is centered difference.feature_names (list of string, length n_input_features, optional) – Names for the input features (e.g.
['x', 'y', 'z']). If None, will use['x0', 'x1', ...].
- Attributes:
model (sklearn.multioutput.MultiOutputRegressor object) – The fitted SINDy model.
n_input_features_ (int) – The total number of input features.
n_output_features_ (int) – The total number of output features. This number is a function of
self.n_input_featuresand the feature library being used.
Methods
Yields the estimated model.
Fit the SINDyEstimator to data, learning a dynamical systems model for the data.
Configure whether metadata should be requested to be passed to the
fitmethod.Configure whether metadata should be requested to be passed to the
predictmethod.Configure whether metadata should be requested to be passed to the
scoremethod.Attributes
Property reporting whether this estimator contains an estimated model.
feature_libraryoptimizerfeature_names- fetch_model()[source]
Yields the estimated model. Can be none if
fitwas not called.- Returns:
model – The estimated SINDy model or none
- Return type:
SINDyModelor None
- fit(x, **kwargs)[source]
Fit the SINDyEstimator to data, learning a dynamical systems model for the data.
- Parameters:
x (array-like or list of array-like, shape (n_samples, n_input_features)) – Training data. If training data contains multiple trajectories, x should be a list containing data for each trajectory. Individual trajectories may contain different numbers of samples.
**kwargs (dict, optional) – Optional keyword arguments to pass to
fitmethod.
- Returns:
self
- Return type:
fitted
SINDyEstimatorinstance
- property has_model
Property reporting whether this estimator contains an estimated model. This assumes that the model is initialized with
Noneotherwise.- Type:
bool
- set_fit_request(*, x: bool | None | str = '$UNCHANGED$') SINDyEstimator
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_predict_request(*, u: bool | None | str = '$UNCHANGED$', x: bool | None | str = '$UNCHANGED$') SINDyEstimator
Configure whether metadata should be requested to be passed to the
predictmethod.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 topredictif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it topredict.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:
u (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for
uparameter inpredict.x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for
xparameter inpredict.
- Returns:
self – The updated object.
- Return type:
object
- set_score_request(*, metric: bool | None | str = '$UNCHANGED$', sample_weight: bool | None | str = '$UNCHANGED$', t: bool | None | str = '$UNCHANGED$', u: bool | None | str = '$UNCHANGED$', x: bool | None | str = '$UNCHANGED$', x_dot: bool | None | str = '$UNCHANGED$') SINDyEstimator
Configure whether metadata should be requested to be passed to the
scoremethod.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 toscoreif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it toscore.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:
metric (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for
metricparameter inscore.sample_weight (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for
sample_weightparameter inscore.t (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for
tparameter inscore.u (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for
uparameter inscore.x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for
xparameter inscore.x_dot (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for
x_dotparameter inscore.
- Returns:
self – The updated object.
- Return type:
object