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

robust_pca sample #18

Closed
chkone opened this issue Nov 21, 2017 · 3 comments
Closed

robust_pca sample #18

chkone opened this issue Nov 21, 2017 · 3 comments

Comments

@chkone
Copy link

chkone commented Nov 21, 2017

Hello,

I just execute this sample:
https://jeankossaifi.github.io/tensorly/rpca.html

Step by step with same data, but during the execution of that:
low_rank_part, sparse_part = robust_pca(X, n_iter_max=20)
I got:
AssertionError Traceback (most recent call last)
in ()
----> 1 low_rank_part, sparse_part = robust_pca(X, n_iter_max=20)

C:\ProgramData\Anaconda3\lib\site-packages\tensorly\decomposition\robust_decomposition.py in robust_pca(X, mask, tol, reg_E, reg_J, mu_init, mu_max, learning_rate, n_iter_max, random_state, verbose)
76
77 # Initialise the decompositions
---> 78 D = T.zeros_like(X) # low rank part
79 E = T.zeros_like(X) # sparse part
80 L_x = T.zeros_like(X) # Lagrangian variables for the (X - D - E - L_x/mu) term

C:\ProgramData\Anaconda3\lib\site-packages\mxnet\ndarray\register.py in zeros_like(data, out, name, **kwargs)

AssertionError: Argument data must have NDArray type, but got [[[ 6.79022540e+00 1.77902254e+01 2.17902254e+01 ..., 3.79022540e+00
0.00000000e+00 -2.20977460e+00]
[ 5.79022540e+00 1.67902254e+01 1.57902254e+01 ..., 6.79022540e+00
-5.20977460e+00 -1.02097746e+01]
[ 5.79022540e+00 1.37902254e+01 2.27902254e+01 ..., 4.79022540e+00
-4.20977460e+00 -1.72097746e+01]
...,
[ -5.32097746e+01 -4.42097746e+01 -4.12097746e+01 ..., -3.12097746e+01
-3.72097746e+01 -3.92097746e+01]
[ -5.32097746e+01 -5.32097746e+01 -5.32097746e+01 ..., 2.55000000e+02
-5.02097746e+01 -5.92097746e+01]
[ -6.12097746e+01 -5.92097746e+01 0.00000000e+00 ..., -4.92097746e
...

Thanks

Cheers

@JeanKossaifi
Copy link
Member

It seems you are using TensorLy with the MXNet backend but feeding the algorithm NumPy arrays: try to set the backend to numpy (import tensorly as tl; tl.set_backend('numpy')), this should solve your issue.

@chkone
Copy link
Author

chkone commented Nov 25, 2017

Thanks that fix the issue

@JeanKossaifi
Copy link
Member

Glad to hear!

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