Created
July 24, 2020 22:11
-
-
Save GabrielHoffman/5c9b678c28c49b3676ece9f189ab9b7f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(glmnet) | |
# You must have glmnet v4 from CRAN | |
# See documentation: https://glmnet.stanford.edu | |
# multinomial elastic-net | |
# you can change alpha | |
fit = glmnet( X_PRS, metadata$Catogory_factor, family="multinomial", alpha = .8, type.multinomial = "grouped") | |
# see regularization path | |
plot(fit) | |
# cross-validation with cv.glmnet | |
# get the predicted cagority, or the scores with predict(fit,...) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment