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

SCN element wise production issue #87

Closed
lhanappa opened this issue May 25, 2020 · 2 comments
Closed

SCN element wise production issue #87

lhanappa opened this issue May 25, 2020 · 2 comments

Comments

@lhanappa
Copy link

Hi, thanks for the normalization algorithm. I found an issue about the element-wise product(**2, iced/iced/normalization/init.py line 101).
If the input of X is the type of matrix, the expression "**2" will make a production of matrices.
If the input of X is the type of ndarray the expression "**2" will make element-wise production.

I think the "**2" in the algorithm is supposed to be element-wise production. So, it might be the explicit expression of element-wise production or check the type of X.
Reproduction:

A = np.matrix(np.ones((2,2)))
print(A**2)
[[2. 2.]
[2. 2.]]

A = np.asarray(np.ones((2,2)))
print(A**2)"
[[1. 1.]
[1. 1.]]

Thanks.

@NelleV
Copy link
Contributor

NelleV commented May 25, 2020

Hello,
I will add a check for matrices but a general rule of thumb with numpy is that you should never use the np.matrix format. Most libraries will not work with matrices as it is not a flexible format and has introduced over the year a number of incoherent operations (np.dot and * are switched between arrays and matrices).
Cheers,
N

@lhanappa
Copy link
Author

Yes, you are right. Thanks

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

2 participants