You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WrappedOptimizer allows users to make SINDy-compatible optimizers (which accept unbiasing and normalizing) from generic regression optimizers. However, its called on a range of SINDy optimizers that natively prevent unbiasing.
Reproducing code example:
importpysindyaspsps.TrappingSR3(unbias=True) # ValueError: Trapping does not allow unbiasingps.WrappedOptimizer(ps.TrappingSR3(), unbias=True) # Should raise a ValueError but does not
Solution
Pretty straightforwardly, we can prevent this by implementing WrappedOptimizer.__new__(cls, optimizer, ...) and checking the type of optimizer. If it's already a ps.BaseOptimzer, then just return it (potentially, verifying that a conflicting unbias is not present)
The text was updated successfully, but these errors were encountered:
WrappedOptimizer allows users to make SINDy-compatible optimizers (which accept unbiasing and normalizing) from generic regression optimizers. However, its called on a range of SINDy optimizers that natively prevent unbiasing.
Reproducing code example:
Solution
Pretty straightforwardly, we can prevent this by implementing
WrappedOptimizer.__new__(cls, optimizer, ...)
and checking the type of optimizer. If it's already aps.BaseOptimzer
, then just return it (potentially, verifying that a conflicting unbias is not present)The text was updated successfully, but these errors were encountered: