powered by
Reduce the dimensionality (i.e., the column number) of a design matrix to a desired level using Lasso.
reduce.dim(fit, X, bound)
The fitted cross validation object generated by glmnet::cv.glmnet.
An input design matrix whose column number is the dimensionality to be reduced.
The targeted number of dimensionality after reducing.
A list of (1) index.X, indices of selected columns in the design matrix; (2) sub.X, indices of selected columns in the design matrix.
# NOT RUN { set.seed(10) X <- matrix(rnorm(100), nrow = 10) Y <- matrix(rnorm(10), nrow = 10) set.seed(11) cvob1 <- glmnet::cv.glmnet(X, Y) tmp <- reduce.dim(fit = cvob1, X = X, bound = 3) # }
Run the code above in your browser using DataLab