| cla_glmnet | R Documentation |
Logistic regression with L1 penalty using glmnet::cv.glmnet.
cla_glmnet(attribute, lambda = c("lambda.min", "lambda.1se"))
attribute |
target attribute name (binary) |
lambda |
which lambda to use ("lambda.min" or "lambda.1se") |
returns a cla_glmnet object
if (requireNamespace("glmnet", quietly = TRUE)) {
data(iris)
iris_bin <- iris
iris_bin$IsVersicolor <- ifelse(iris_bin$Species == "versicolor", 1, 0)
model <- cla_glmnet("IsVersicolor")
model <- fit(model, iris_bin)
pred <- predict(model, iris_bin)
table(pred, iris_bin$IsVersicolor)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.