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

Error with first provided example #58

Open
anonym-ai opened this issue Aug 27, 2024 · 0 comments
Open

Error with first provided example #58

anonym-ai opened this issue Aug 27, 2024 · 0 comments

Comments

@anonym-ai
Copy link

anonym-ai commented Aug 27, 2024

When running the example in the first notebook,
I have the following error:

in code:

        slice_sizes = x_encoded.sum(axis=0).A[0]
        slice_errors = errors @ x_encoded
        max_slice_errors = x_encoded.T.multiply(errors).max(axis=1).A[:, 0]

AttributeError: coo_matrix has no attribute A

It seems like x_encoded.T.multiply(errors).max(axis=1) is a scipy.sparse.coo_matrix and not a np.matrix

I have no idea if x_encoded.T.multiply(errors) is as scipy.sparse.csr like matrix

but modifing the line with:

-        max_slice_errors = x_encoded.T.multiply(errors).max(axis=1).A[:, 0]
+        max_slice_errors = x_encoded.T.multiply(errors).max(axis=1).toarray()[:, 0]

The whole code runs smoothly.
I guess this is not optimal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant