| details_logistic_reg_keras3 | R Documentation |
keras3_mlp() fits a generalized linear model for binary outcomes using version 3 of Keras. A
linear combination of the predictors is used to model the log odds of an
event.
For this engine, there is a single mode: classification
This model has one tuning parameter:
penalty: Amount of Regularization (type: double, default: 0.0)
For penalty, the amount of regularization is only L2 penalty (i.e.,
ridge or weight decay).
logistic_reg(penalty = double(1)) |>
set_engine("keras3") |>
translate()
## Logistic Regression Model Specification (classification) ## ## Main Arguments: ## penalty = double(1) ## ## Computational engine: keras3 ## ## Model fit template: ## parsnip::keras3_mlp(x = missing_arg(), y = missing_arg(), penalty = double(1), ## hidden_units = 1, act = "linear")
keras3_mlp() is a parsnip wrapper around keras3 code
for neural networks. This model fits a logistic regression as a network
with a single hidden unit.
Factor/categorical predictors need to be converted to numeric values
(e.g., dummy or indicator variables) for this engine. When using the
formula method via fit(), parsnip will
convert factor columns to indicators.
Predictors should have the same scale. One way to achieve this is to center and scale each so that each predictor has mean zero and a variance of one.
The underlying model implementation does not allow for case weights.
parsnip:::get_from_env("logistic_reg_predict") |>
dplyr::filter(engine == "keras3") |>
dplyr::select(mode, type)
## # A tibble: 2 x 2 ## mode type ## <chr> <chr> ## 1 classification class ## 2 classification prob
Models fitted with this engine may require native serialization methods to be properly saved and/or passed between R sessions. To learn more about preparing fitted models for serialization, see the bundle package.
The “Fitting and Predicting with parsnip”
article
contains examples for logistic_reg() with the "keras3" engine.
Hoerl, A., & Kennard, R. (2000). Ridge Regression: Biased Estimation for Nonorthogonal Problems. Technometrics, 42(1), 80-86.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.