DataSlingers / ExclusiveLasso

Generalized Linear Models with the Exclusive Lasso Penalty
https://DataSlingers.github.io/ExclusiveLasso/
5 stars 2 forks source link

Unable to run exclusive_lasso when Matrix size too large #19

Open joannytan opened 6 months ago

joannytan commented 6 months ago

I am running into the error of

Error: Mat::init(): requested size is too large; suggest to enable ARMA_64BIT_WORD

I understand that this is due to large matrix error which should be the issue from the RcppArmadillo package. The sample code that run into issue as below.

library(glmnet)
library(ExclusiveLasso)

N = 80000 # number of observations
p = 35  # number of variables

# random generated X
X = matrix(rnorm(N*p), ncol=p)

# standardization : mean = 0, std=1
X = scale(X)

# artificial coefficients
beta = c(0.15,-0.33,0.25,-0.25,0.05,0,0,0,0.5,0.2,
         0.15,-0.33,0.25,-0.25,0.05,0,0,0,0.5,0.2,
         0.15,-0.33,0.25,-0.25,0.05,0,0,0,0.5,0.2,
         1, -0.2, 0.2, 0.1, 0.5)

# Y variable, standardized Y
y = X%*%beta + rnorm(N, sd=0.5)
#y = scale(y)

# group index for X variables
v.group <- rep(1:10, length.out = 35 )

#--------------------------------------------
# Model with a given lambda
#--------------------------------------------
# exclusive lasso
ex <- exclusive_lasso(X, y,lambda = 0.2, 
                      groups = v.group, family="gaussian", 
                      intercept = F)