pysindy
pysindy copied to clipboard
Optimizer parameters validation improvement
Right now, parameters validation is done in the constructor as follows https://github.com/dynamicslab/pysindy/blob/3e8a4455fd4de046225344dda9b516d0d013ee36/pysindy/optimizers/sr3.py#L138-L163
According to the scikit-learn documents, validations should be done in the fit method because if we call set_params, it will bypass the validation in the constructor.
Reproducing code example:
from pysindy.optimizers import SR3
opt = SR3(threshold=-1)
# raises "ValueError: threshold cannot be negative"
from pysindy.optimizers import SR3
opt = SR3()
opt.set_params(threshold=-1)
# no error