Skip to content

Implementation of CP-APR algorithm#27

Open
theosotr wants to merge 2 commits intomnick:masterfrom
theosotr:cp-apr
Open

Implementation of CP-APR algorithm#27
theosotr wants to merge 2 commits intomnick:masterfrom
theosotr:cp-apr

Conversation

@theosotr
Copy link
Copy Markdown

@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
Copy Markdown

Looks good - thanks!

@theosotr
Copy link
Copy Markdown
Author

Thanks also @hskarpetis for its valuable contributions.

@mnick
Copy link
Copy Markdown
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
Copy Markdown

brianholland commented Nov 26, 2016 via email

sktensor/cp.py Outdated
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:
Copy link
Copy Markdown

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.

sktensor/cp.py Outdated
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()
Copy link
Copy Markdown

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