details_logistic_reg_LiblineaR: Logistic regression via LiblineaR

details_logistic_reg_LiblineaRR Documentation

Logistic regression via LiblineaR


LiblineaR::LiblineaR() fits a generalized linear model for binary outcomes. 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

Tuning Parameters

This model has 2 tuning parameters:

  • penalty: Amount of Regularization (type: double, default: see below)

  • mixture: Proportion of Lasso Penalty (type: double, default: 0)

For LiblineaR models, the value for mixture can either be 0 (for ridge) or 1 (for lasso) but not other intermediate values. In the LiblineaR::LiblineaR() documentation, these correspond to types 0 (L2-regularized) and 6 (L1-regularized).

Be aware that the LiblineaR engine regularizes the intercept. Other regularized regression models do not, which will result in different parameter estimates.

Translation from parsnip to the original package

logistic_reg(penalty = double(1), mixture = double(1)) %>% 
  set_engine("LiblineaR") %>% 
## Logistic Regression Model Specification (classification)
## Main Arguments:
##   penalty = double(1)
##   mixture = double(1)
## Computational engine: LiblineaR 
## Model fit template:
## LiblineaR::LiblineaR(x = missing_arg(), y = missing_arg(), cost = Inf, 
##     type = double(1), verbose = FALSE)

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(), 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 “Fitting and Predicting with parsnip” article contains examples for logistic_reg() with the "LiblineaR" engine.


  • Hastie, T, R Tibshirani, and M Wainwright. 2015. Statistical Learning with Sparsity. CRC Press.

  • Kuhn, M, and K Johnson. 2013. Applied Predictive Modeling. Springer.

parsnip documentation built on June 24, 2024, 5:14 p.m.