I am trying to use LASSO regression for selecting important features. I have 27 numeric features and one categorical class variable with 3 classes. I used the following code:
x <- as.matrix(data[, -1])
y <- data[,1]
fplasso <- glmnet(x, y, family = "multinomial")
#Perform cross-validation
cvfp <- cv.glmnet(x, y, family = "multinomial", type.measure = "class")
#Select features (with coefficients not shrunk to zero)
coef(cvfp, s = "lambda.min")
It is providing me coefficients of features for each of the 3 separate classes. Since I am using LASSO for the first time, I am just wondering if it is a correct way to do the feature selection? Also, should the coefficients of all features be reported per class or should there be a single coefficient of each feature overall? In other words, will the coefficients be different for each feature depending upon each class?