Description
The first problem I encountered while trying out the example code on VSCode was the numpy error, i.e., numpy has no np.maths.factorial attributes. I went to the source code file on my local PC and tried to correct it, but I was still getting an error about the self-differentiation function.
however after going through all the raised issues on the topic I decided to try out the code on Jupyter Notebook online and below was the error I got
TypeError: LinearRegression.init() got an unexpected keyword argument 'normalize'
Reproducing code example:
model = ps.SINDy(feature_names=["x", "y"])
model.fit(X, t=t)
import pysindy
import numpy as np
t = np.linspace(0, 1, 100)
x = 3 * np.exp(-2 * t)
y = 0.5 * np.exp(t)
X = np.stack((x, y), axis=-1) # First column is x, second is y
model = ps.SINDy(feature_names=["x", "y"])
model.fit(X, t=t)
Error message:
TypeError Traceback (most recent call last)
Cell In[3], line 1
----> 1 model = ps.SINDy(feature_names=["x", "y"])
2 model.fit(X, t=t)
File ~\anaconda3\Lib\site-packages\pysindy\pysindy.py:152, in SINDy.init(self, optimizer, feature_library, differentiation_method, feature_names, t_default, discrete_time)
142 def init(
143 self,
144 optimizer=None,
(...)
149 discrete_time=False,
150 ):
151 if optimizer is None:
--> 152 optimizer = STLSQ()
153 self.optimizer = optimizer
154 if feature_library is None:
File ~\anaconda3\Lib\site-packages\pysindy\optimizers\stlsq.py:105, in STLSQ.init(self, threshold, alpha, max_iter, ridge_kw, normalize, fit_intercept, copy_X, initial_guess)
94 def init(
95 self,
96 threshold=0.1,
(...)
103 initial_guess=None,
104 ):
--> 105 super(STLSQ, self).init(
106 max_iter=max_iter,
107 normalize=normalize,
108 fit_intercept=fit_intercept,
109 copy_X=copy_X,
110 )
112 if threshold < 0:
113 raise ValueError("threshold cannot be negative")
File ~\anaconda3\Lib\site-packages\pysindy\optimizers\base.py:81, in BaseOptimizer.init(self, max_iter, normalize, fit_intercept, initial_guess, copy_X)
73 def init(
74 self,
75 max_iter=20,
(...)
79 copy_X=True,
80 ):
---> 81 super(BaseOptimizer, self).init(
82 fit_intercept=fit_intercept, normalize=normalize, copy_X=copy_X
83 )
85 if max_iter <= 0:
86 raise ValueError("max_iter must be positive")
TypeError: LinearRegression.init() got an unexpected keyword argument 'normalize'