details_logistic_reg_keras: Logistic regression via keras

Description Details

Description

keras_mlp() fits a generalized linear model for binary outcomes. A linear combination of the predictors is used to model the log odds of an event.

Details

For this engine, there is a single mode: classification

Tuning Parameters

This model has one tuning parameter:

For penalty, the amount of regularization is only L2 penalty (i.e., ridge or weight decay).

Translation from parsnip to the original package

logistic_reg(penalty = double(1)) %>% 
  set_engine("keras") %>% 
  translate()
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Logistic Regression Model Specification (classification)
## 
## Main Arguments:
##   penalty = double(1)
## 
## Computational engine: keras 
## 
## Model fit template:
## parsnip::keras_mlp(x = missing_arg(), y = missing_arg(), penalty = double(1), 
##     hidden_units = 1, act = "linear")

keras_mlp() is a parsnip wrapper around keras code for neural networks. This model fits a linear regression as a network with a single hidden unit.

Preprocessing requirements

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.model_spec(), 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.

Examples

The “Fitting and Predicting with parsnip” article contains examples for logistic_reg() with the "keras" engine.

References


parsnip documentation built on July 21, 2021, 5:08 p.m.