shredx.modules.moe_mixin.MOESINDyLayerHelpersMixin#
- class shredx.modules.moe_mixin.MOESINDyLayerHelpersMixin#
Bases:
objectMixin providing helper methods for Mixture of Experts models with SINDy layers.
Provides common functionality for printing, modifying, and analyzing SINDy coefficients across multiple expert networks.
Methods
get_sindy_layer_coefficients_eigenvalues()Get the eigenvalues of SINDy coefficient matrices for all SINDy experts.
get_sindy_layer_coefficients_sum()Compute the sum of absolute SINDy coefficients across all experts (sparsity regularization).
print_sindy_layer_coefficients()Print the SINDy coefficients for all experts in a human-readable format.
set_forecast_length(forecast_length)Set the forecast length for the model and all expert SINDy layers.
threshold_sindy_layer_coefficients(threshold)Apply sparsity thresholding to SINDy coefficients for all experts.
Notes
Class Methods:
print_sindy_layer_coefficients():
Prints the SINDy coefficients for all experts in a human-readable format (polynomial expression per hidden dimension).
- Returns:
None.
set_forecast_length(forecast_length):
Sets the forecast length for the model and all expert SINDy layers.
- Parameters:
forecast_length : int. Number of timesteps to forecast.
- Returns:
None.
get_sindy_layer_coefficients_eigenvalues():
Returns the eigenvalues of SINDy coefficient matrices for all experts.
- Returns:
list. List of eigenvalue tensors, one per expert.
get_sindy_layer_coefficients_sum():
Computes the sum of absolute SINDy coefficients across all experts (used as a sparsity regularization term).
- Returns:
float. Sum of square roots of absolute coefficient sums.
threshold_sindy_layer_coefficients(threshold, verbose):
Applies sparsity thresholding: sets coefficients with absolute value below the threshold to zero for all experts.
- Parameters:
threshold : float. Coefficients below this are zeroed.
verbose : bool, optional. If True, print information about thresholding. Default is
False.
- Returns:
None.