vindy.callbacks package
Submodules
vindy.callbacks.pdf_threshold_callback module
- class PDFThresholdCallback(freq=1, threshold=1, on_train_end=False, **kwargs)[source]
Bases:
Callback
- cancel_coefficients()[source]
Cancel the coefficients of the SINDy layer if their corresponding probability density function at zero is above the threshold, i.e. if pdf(0) > self.threshold
- Return type:
None
- on_epoch_end(epoch, logs=None)[source]
Called at the end of an epoch.
Subclasses should override for any actions to run. This function should only be called during TRAIN mode.
- Args:
epoch: Integer, index of epoch. logs: Dict, metric results for this training epoch, and for the
validation epoch if validation is performed. Validation result keys are prefixed with val_. For training epoch, the values of the Model’s metrics are returned. Example: {‘loss’: 0.2, ‘accuracy’: 0.7}.
vindy.callbacks.save_coefficients_callback module
vindy.callbacks.sindy_callback module
- class SindyCallback(x, dxdt, dxddt, mu, t, freq=100, train_end=False, ensemble=False, subset_size=0.5, n_subsets=100, threshold=0.1, thresholder: str = 'l0', z_names=None, mu_names=None, print_precision=3, **kwargs)[source]
Bases:
Callback
Callback for the SINDy layer. This callback is used to update the identified coefficients of the SINDy layer.
- call_pySINDy(z_feat, z_dot, times_train, fixed_coeffs, feat_ids, mask)[source]
Fit a separate SINDy model using the provided data and constraints.
- Parameters:
z_feat (list of array-like) – Latent variables and their features.
z_dot (list of array-like) – Time derivatives of latent variables.
times_train (array-like) – Time.
fixed_coeffs (array-like) – Fixed coefficients for the SINDy model.
feat_ids (array-like) – IDs of the selected features.
mask (array-like) – Mask specifying which features are used in the SINDy model.
- Returns:
Fitted SINDy model.
- Return type:
pysindy.SINDy
- on_epoch_end(epoch, logs=None)[source]
Perform SINDy update at the end of every specified number of epochs.
- Parameters:
epoch (int) – Current epoch number.
logs (dict, optional) – Dictionary of logs (default is None).
- on_train_end(logs=None)[source]
Perform SINDy update at the end of training if specified.
- Parameters:
logs (dict, optional) – Dictionary of logs (default is None).
- prepare_data_for_pysindy(t, z_feat, dzdt, dzddt=None)[source]
Prepare training data for the separate SINDy model.
- Parameters:
t (array-like) – Time.
z_feat (array-like) – Latent variables and their features.
dzdt (array-like) – Time derivative of latent variables.
dzddt (array-like, optional) – Second time derivative of latent variables (default is None).
- Returns:
Prepared latent variables, their time derivatives, and time.
- Return type:
tuple
vindy.callbacks.spotify_callback module
vindy.callbacks.threshold_prune_callback module
- class ThresholdPruneCallback(freq=1, threshold=0.01, on_train_end=False, start_epoch=0)[source]
Bases:
Callback
- on_epoch_end(epoch, logs=None)[source]
Called at the end of an epoch during training.
- Parameters:
epoch (int) – The current epoch number.
logs (dict, optional) – Dictionary of logs from the training process.