Skip to content

[BUG] FROLS makes .history_ an array, not a list. #377

Open
@Jacob-Stevens-Haas

Description

@Jacob-Stevens-Haas

Reproducing code example:

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"

PySINDy/Python version information:

master/3.10

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions