| 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 <- factor(ifelse(
iris_bin$Species == "versicolor",
"versicolor",
"not_versicolor"
))
model <- cla_glmnet("IsVersicolor")
model <- fit(model, iris_bin)
pred <- predict(model, iris_bin)
eval <- evaluate(model, adjust_class_label(iris_bin$IsVersicolor), pred)
eval$metrics
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.