-
Notifications
You must be signed in to change notification settings - Fork 90
/
Copy pathdetails_multinom_reg_glmnet.Rd
106 lines (88 loc) · 3.68 KB
/
details_multinom_reg_glmnet.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/multinom_reg_glmnet.R
\name{details_multinom_reg_glmnet}
\alias{details_multinom_reg_glmnet}
\title{Multinomial regression via glmnet}
\description{
\code{\link[glmnet:glmnet]{glmnet::glmnet()}} fits a model that uses linear predictors to predict
multiclass data using the multinomial distribution.
}
\details{
For this engine, there is a single mode: classification
\subsection{Tuning Parameters}{
This model has 2 tuning parameters:
\itemize{
\item \code{penalty}: Amount of Regularization (type: double, default: see below)
\item \code{mixture}: Proportion of Lasso Penalty (type: double, default: 1.0)
}
The \code{penalty} parameter has no default and requires a single numeric
value. For more details about this, and the \code{glmnet} model in general,
see \link{glmnet-details}. As for \code{mixture}:
\itemize{
\item \code{mixture = 1} specifies a pure lasso model,
\item \code{mixture = 0} specifies a ridge regression model, and
\item \verb{0 < mixture < 1} specifies an elastic net model, interpolating lasso
and ridge.
}
}
\subsection{Translation from parsnip to the original package}{
\if{html}{\out{<div class="sourceCode r">}}\preformatted{multinom_reg(penalty = double(1), mixture = double(1)) \%>\%
set_engine("glmnet") \%>\%
translate()
}\if{html}{\out{</div>}}
\if{html}{\out{<div class="sourceCode">}}\preformatted{## Multinomial Regression Model Specification (classification)
##
## Main Arguments:
## penalty = 0
## mixture = double(1)
##
## Computational engine: glmnet
##
## Model fit template:
## glmnet::glmnet(x = missing_arg(), y = missing_arg(), weights = missing_arg(),
## alpha = double(1), family = "multinomial")
}\if{html}{\out{</div>}}
}
\subsection{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 \code{\link[=fit.model_spec]{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. By default, \code{\link[glmnet:glmnet]{glmnet::glmnet()}} uses
the argument \code{standardize = TRUE} to center and scale the data.
}
\subsection{Examples}{
The “Fitting and Predicting with parsnip” article contains
\href{https://parsnip.tidymodels.org/articles/articles/Examples.html#multinom-reg-glmnet}{examples}
for \code{multinom_reg()} with the \code{"glmnet"} engine.
}
\subsection{Case weights}{
This model can utilize case weights during model fitting. To use them,
see the documentation in \link{case_weights} and the examples
on \code{tidymodels.org}.
The \code{fit()} and \code{fit_xy()} arguments have arguments called
\code{case_weights} that expect vectors of case weights.
}
\subsection{Sparse Data}{
This model can utilize sparse data during model fitting and prediction.
Both sparse matrices such as dgCMatrix from the \code{Matrix} package and
sparse tibbles from the \code{sparsevctrs} package are supported. See
\link{sparse_data} for more information.
}
\subsection{Saving fitted model objects}{
This model object contains data that are not required to make
predictions. When saving the model for the purpose of prediction, the
size of the saved object might be substantially reduced by using
functions from the \href{https://butcher.tidymodels.org}{butcher} package.
}
\subsection{References}{
\itemize{
\item Hastie, T, R Tibshirani, and M Wainwright. 2015. \emph{Statistical Learning
with Sparsity}. CRC Press.
\item Kuhn, M, and K Johnson. 2013. \emph{Applied Predictive Modeling}. Springer.
}
}
}
\keyword{internal}