Skip to content

Commit

Permalink
fixed dswah#357 where methode is depricated
Browse files Browse the repository at this point in the history
  • Loading branch information
ouslan committed Dec 8, 2024
1 parent a6c14e4 commit 298a40b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions pygam/pygam.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ def _initial_estimate(self, y, modelmat):

# solve the linear problem
return np.linalg.solve(
load_diagonal(modelmat.T.dot(modelmat).A), modelmat.T.dot(y_)
load_diagonal(modelmat.T.dot(modelmat).toarray()), modelmat.T.dot(y_)
)

# not sure if this is faster...
Expand Down Expand Up @@ -780,7 +780,7 @@ def _pirls(self, X, Y, weights):
self._on_loop_start(vars())

WB = W.dot(modelmat[mask, :]) # common matrix product
Q, R = np.linalg.qr(WB.A)
Q, R = np.linalg.qr(WB.toarray())

if not np.isfinite(Q).all() or not np.isfinite(R).all():
raise ValueError(
Expand Down Expand Up @@ -1401,7 +1401,7 @@ def _get_quantiles(
idxs = self.terms.get_coef_indices(term)
cov = self.statistics_['cov'][idxs][:, idxs]

var = (modelmat.dot(cov) * modelmat.A).sum(axis=1)
var = (modelmat.dot(cov) * modelmat.toarray()).sum(axis=1)
if prediction:
var += self.distribution.scale

Expand Down
2 changes: 1 addition & 1 deletion pygam/terms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1500,7 +1500,7 @@ def _build_marginal_constraints(self, i, coef, constraint_lam, constraint_l2):
)

# now enter it into the composite
composite_C[tuple(np.meshgrid(slice_, slice_))] = slice_C.A
composite_C[tuple(np.meshgrid(slice_, slice_))] = slice_C.toarray()

return sp.sparse.csc_matrix(composite_C)

Expand Down
8 changes: 4 additions & 4 deletions pygam/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def cholesky(A, sparse=True, verbose=True): # noqa: F811

if sparse:
return L.T # upper triangular factorization
return L.T.A # upper triangular factorization
return L.T.toarray() # upper triangular factorization

else:
msg = (
Expand All @@ -78,7 +78,7 @@ def cholesky(A, sparse=True, verbose=True): # noqa: F811
warnings.warn(msg)

if sp.sparse.issparse(A):
A = A.A
A = A.toarray()

try:
L = sp.linalg.cholesky(A, lower=False)
Expand Down Expand Up @@ -951,10 +951,10 @@ def tensor_product(a, b, reshape=True):
raise ValueError('both arguments must have the same number of samples')

if sp.sparse.issparse(a):
a = a.A
a = a.toarray()

if sp.sparse.issparse(b):
b = b.A
b = b.toarray()

tensor = a[..., :, None] * b[..., None, :]

Expand Down

0 comments on commit 298a40b

Please sign in to comment.