sparklyr::ml_logistic_regression() fits a model that uses linear
predictors to predict multiclass data using the multinomial distribution.
For this engine, there is a single mode: classification
This model has 2 tuning parameters:
penalty: Amount of Regularization (type: double, default: 0.0)
mixture: Proportion of Lasso Penalty (type: double, default: 0.0)
penalty, the amount of regularization includes both the L1 penalty
(i.e., lasso) and the L2 penalty (i.e., ridge or weight decay).
A value of
mixture = 1 corresponds to a pure lasso model, while
mixture = 0 indicates ridge regression.
## Multinomial Regression Model Specification (classification) ## ## Main Arguments: ## penalty = double(1) ## mixture = double(1) ## ## Computational engine: spark ## ## Model fit template: ## sparklyr::ml_logistic_regression(x = missing_arg(), formula = missing_arg(), ## weight_col = missing_arg(), reg_param = double(1), elastic_net_param = double(1), ## family = "multinomial")
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. By default,
ml_multinom_regression() uses the
standardization = TRUE to center and scale the data.
For models created using the
"spark" engine, there are several things
The predictions will always be in a Spark table format. The names will be the same as documented but without the dots.
There is no equivalent to factor columns in Spark tables so class predictions are returned as character columns.
To retain the model object for a new R session (via
model$fit element of the parsnip object should be serialized via
ml_save(object$fit) and separately saved to disk. In a new
session, the object can be reloaded and reattached to the parsnip
Luraschi, J, K Kuo, and E Ruiz. 2019. Mastering Spark with R. O’Reilly Media
Hastie, T, R Tibshirani, and M Wainwright. 2015. Statistical Learning with Sparsity. CRC Press.
Kuhn, M, and K Johnson. 2013. Applied Predictive Modeling. Springer.