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

dimensionality problems with holq #1

Open
shabbychef opened this issue Dec 7, 2022 · 3 comments
Open

dimensionality problems with holq #1

shabbychef opened this issue Dec 7, 2022 · 3 comments

Comments

@shabbychef
Copy link

First, thanks for writing this package. When I tried to use the holq function on my data I got a strange error which I can replicate with toy data here. The problem seems to arise when one dimension of the input tensor is bigger than the product of the other dimensions, which I think causes some issues in the 2-dimensional LQ used (probably you don't get a full LQ or something):

# this runs (but takes a while)
p <- c(11, 3, 4)
set.seed(1234)
X <- array(stats::rnorm(prod(p)), dim = p)
holq(X)

# this errors
p <- c(13, 3, 4)
set.seed(1234)
X <- array(stats::rnorm(prod(p)), dim = p)
holq(X)

I get the error

Error in A[[mat_index]] %*% L_k : non-conformable arguments

It could be that I have misunderstood how the code is supposed to work, and maybe the HOLQ is not defined for such "weirdly" shaped tensors?

@dcgerard
Copy link
Owner

dcgerard commented Dec 9, 2022

Hey @shabbychef,

Thanks for the comment!

Yes, I don't think the way we implemented the algorithm allows for one mode's dimension to be greater than the product of every other mode's dimensions. Not sure if there is a solution to the optimization problem we set up to define the HOLQ in that setting. If there were, I don't think it would not be unique. I would need to think about it more.

  • David

@shabbychef
Copy link
Author

Looking at the code, I agree it is not clear how to generalize to this case. However, the holq function output is used to compute the isvd, which I had hoped to use. It seems like the Incredible SVD should be defined for "oddly" shaped tensors, in analogy to how SVD is defined for non-square matrices.

@dcgerard
Copy link
Owner

dcgerard commented Dec 9, 2022

I agree! Not sure what your application is, but in the meantime, you can try out the HOOI (https://doi.org/10.1137/S0895479898346995) (implemented in tensr::hooi()) or the HOSVD (https://doi.org/10.1137/S0895479896305696) (implemented in tensr::hosvd()). Though, there might be better implementations out there.

Best,
David

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

No branches or pull requests

2 participants