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

validObject Error in huge.mb for small sample data #17

Open
zdk123 opened this issue Jan 15, 2022 · 0 comments
Open

validObject Error in huge.mb for small sample data #17

zdk123 opened this issue Jan 15, 2022 · 0 comments

Comments

@zdk123
Copy link
Contributor

zdk123 commented Jan 15, 2022

I'm trying to understand this error - which seems to occur when re-constructing a sparse matrix on small-sample data and perhaps with small values of lambda.

Reproduce the error:

library(huge)
set.seed(10010)
dat <- huge.generator(n=5, d=250)

# these fail
est1 <- huge(dat$data, method='mb', scr=FALSE, nlambda=100, lambda.min.ratio = 5e-5)
est2 <- huge(dat$data, method='mb', scr=FALSE, nlambda=10, lambda.min.ratio = 1e-4)
Error in validObject(.Object) : 
  invalid class “dgCMatrix” object: all row indices must be between 0 and nrow-1

Interestingly, small tweaks to the lambda path seem to run OK.

est3 <- huge(dat$data, method='mb', scr=FALSE, nlambda=100, lambda.min.ratio = 2e-4)
est4 <- huge(dat$data, method='mb', scr=FALSE, nlambda=10, lambda.min.ratio = 2e-4)

and if we pass in the correlation matrix directly, previously failed are OK

est1.cor <- huge(cor(dat$data), method='mb', scr=FALSE, nlambda=100, lambda.min.ratio = 5e-5)
est2.cor <- huge(cor(dat$data), method='mb', scr=FALSE, nlambda=10, lambda.min.ratio = 1e-4)
est3.cor <- huge(cor(dat$data), method='mb', scr=FALSE, nlambda=100, lambda.min.ratio = 2e-4)
est4.cor <- huge(cor(dat$data), method='mb', scr=FALSE, nlambda=10, lambda.min.ratio = 2e-4)

It seems that the only difference when passing the correlation matrix seems to be the maxdf is d rather than n.

The error seems to be coming from this block:
https://github.com/HMJiangGatech/huge/blob/master/R/huge.mb.R#L107-L120
It seems perhaps the for loop is trying to index values that aren't there - perhaps because maxdf isn't large enough (in which case I don't understand the purpose of the parameter).

@zdk123 zdk123 changed the title Error in validObject for huge.mb for small sample data validObject Error in huge.mb for small sample data Jan 15, 2022
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

1 participant