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

Implementation of CP-APR algorithm #27

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

theosotr
Copy link

@theosotr theosotr commented Nov 25, 2016

CP-APR algorithm
https://arxiv.org/pdf/1112.2414.pdf

The results of this implementation were tested against of that of MATLAB tensor toolbox, using the method described here.
https://pdfs.semanticscholar.org/71b5/d7ad21cf479c0816b9df00b19df87f8787a1.pdf

@brianholland
Copy link

Looks good - thanks!

@theosotr
Copy link
Author

Thanks also @hskarpetis for its valuable contributions.

@mnick
Copy link
Owner

mnick commented Nov 26, 2016

Thanks for the contribution!

It would be nice to have a small test case to check for correctness of the factorization. For instance, we can check the factors for a tensor where we know the correct factorization via numpy.allclose()

We can load matlab files via scipy.io. So checking against matlab results would work.

@brianholland
Copy link

brianholland commented Nov 26, 2016 via email

for j in range(inner_iter):
phi[n] = np.dot(X.unfold(n) / np.maximum(np.dot(b, pi), e),
pi.transpose())
if np.amax(np.abs(np.ravel(np.minimum(M.U[n], 1-phi[n])))) < t:

Choose a reason for hiding this comment

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

Here do we need b instead of M.U[n] to match the paper? The paper has a small floor on M.U[n] also to keep zeros from entering in.

S[(phi[n] > 1) & (M.U[n] < k_tol)] = k
b = np.dot((M.U[n] + S), np.diag(M.lmbda))
pi = khatrirao(tuple(
[M.U[i] for i in range(n) + range(n + 1, N)])).transpose()

Choose a reason for hiding this comment

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

Factors need to be in reversed order I think

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

Successfully merging this pull request may close these issues.

3 participants