csr_matrix Attribute error / GAM's not running
AttributeError Traceback (most recent call last) Cell In[162], line 4 1 from pygam.datasets import wage 3 X, y = wage() ----> 4 gam = LinearGAM(s(0) + s(1) + f(2)).fit(X, y)
File c:\Users\irmak\Desktop\datascience\lulzern.conda\Lib\site-packages\pygam\pygam.py:913, in GAM.fit(self, X, y, weights) 910 self.statistics_['m_features'] = X.shape[1] 912 # optimize --> 913 self._pirls(X, y, weights) 914 # if self._opt == 0: 915 # self._pirls(X, y, weights) 916 # if self._opt == 1: 917 # self._pirls_naive(X, y) 918 return self
File c:\Users\irmak\Desktop\datascience\lulzern.conda\Lib\site-packages\pygam\pygam.py:751, in GAM._pirls(self, X, Y, weights) 747 # S += self._H # add any user-chosen minumum penalty to the diagonal 748 749 # if we dont have any constraints, then do cholesky now 750 if not self.terms.hasconstraint: --> 751 E = self._cholesky(S + P, sparse=False, verbose=self.verbose) 753 min_n_m = np.min([m, n]) 754 Dinv = np.zeros((min_n_m + m, m)).T ... ---> 81 A = A.A 83 try: 84 L = sp.linalg.cholesky(A, lower=False)
AttributeError: 'csr_matrix' object has no attribute 'A'
I have this error even for a simple model like this : from pygam.datasets import wage
X, y = wage()
Is there anything I can do? gam = LinearGAM(s(0) + s(1) + f(2)).fit(X, y)
See https://github.com/dswah/pyGAM/issues/357
Hi, this has been solved!
Please upgrade your pygam to >= 0.10.1