import pysindy as ps
import numpy as np
rng = np.random.default_rng(94)
x = rng.standard_normal(size=(100,))
model = ps.SINDy(optimizer=ps.FROLS())
model.fit(x, t=1)
model2 = ps.SINDy(optimizer=ps.STLSQ())
model2.fit(x, t=1)
print(type(model.optimizer.history_))
print(type(model2.optimizer.history_))
Result:
<class 'numpy.ndarray'>
<class 'list'>
Expected
<class 'list'>
<class 'list'>
Discussion
When working on #319, I noticed that the history_ argument is documented as a list. FROLS turns it into an array. Prevents adding the result of unbiasing to history_. Solution is simple - edit FROLS to keep it a list. As a follow-on, add a history_ entry after _unbias() and slim down all the BaseOptimizer subclass docstrings with "See Base Class"
Reproducing code example:
Result:
Expected
Discussion
When working on #319, I noticed that the
history_
argument is documented as a list. FROLS turns it into an array. Prevents adding the result of unbiasing tohistory_
. Solution is simple - edit FROLS to keep it a list. As a follow-on, add ahistory_
entry after_unbias()
and slim down all theBaseOptimizer
subclass docstrings with "See Base Class"PySINDy/Python version information:
master
/3.10