Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix using .A instead of .toarray() #61

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Conversation

michalk8
Copy link
Collaborator

@michalk8 michalk8 commented Aug 5, 2024

No description provided.

@michalk8 michalk8 added the bug Something isn't working label Aug 5, 2024
@michalk8 michalk8 self-assigned this Aug 5, 2024
@michalk8 michalk8 requested a review from msmdev August 5, 2024 23:28
Copy link
Owner

@msmdev msmdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really getting the motivation/justification for your changes here. Could you please explain the reasoning behind them to me? Thank you!

@@ -524,6 +525,7 @@ def test_gpcca_brandts_sparse_is_not_densified(self, P: np.ndarray, sd: np.ndarr
with pytest.raises(ValueError, match=r"Sparse implementation is only available for `method='krylov'`."):
GPCCA(csr_matrix(P), eta=sd, method="brandts").optimize(3)

@pytest.mark.skipif(Version(np.__version__) >= Version("2"), reason="Eigenvalue mismatch.")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you skip this test if numpy version is >=2? Why is it ok for newer numpy versions to fail this test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been trying to figure out why new numpy version causes this test to fail, but was unable to figure it out. I will try later do a bisect on the commits, see exactly why, but was thinking in the meantime we could just skip it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reverted this, will leave this for a future PR to investigate.

@@ -70,7 +70,7 @@ def bdc(q: np.ndarray, p: np.ndarray, sparse: bool = True) -> Tuple[np.ndarray,
mu[0] = 1.0
mu[1:] = np.cumprod(p[:-1] / q[1:])

return (P if sparse else P.A), mu / np.sum(mu)
return (P if sparse else P.toarray()), mu / np.sum(mu)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the problem here, exactly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because scipy deprecated .A and .toarray() should be used in favor.

@michalk8
Copy link
Collaborator Author

I'm not really getting the motivation/justification for your changes here. Could you please explain the reasoning behind them to me? Thank you!

Regarding the changes in the docs, sphinx was throwing some warning, so I corrected the template and conf.py - no warnings now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants