View source: R/dCVnet_utilities.R
tidy_predict.glmnet | R Documentation |
return a dataframe of glmnet predictions associated with outcomes (when these are provided). Standardises return over different model families.
tidy_predict.glmnet(
mod,
newx,
s,
family,
newy = NULL,
newoffset = NULL,
label = "",
binomial_thresh = 0.5,
...
)
mod |
a fitted glmnet object (alpha is determined by the object) |
newx |
new values of x for which predictions are desired. |
s |
the value of penalty parameter lambda at which predictions are required. |
family |
the glmnet model family |
newy |
outcome associated with newx. If provided these will be included in the output (useful for subsequent performance assessment). |
newoffset |
if an offset is used in the fit, then one must be supplied for making predictions. |
label |
an optional label (value is added in column "label") |
binomial_thresh |
this allows non-default thresholds to be used for classification. This is only relevant for binary classification. E.g. for an imbalanced binary outcome with 70:30 allocation, setting the decision threshold to 0.7 gives a better balance of sensitivity and specificity without requiring threshold tuning (as in AUC optimal threshold). |
... |
passed to |
a data.frame
containing column(s) for:
'prediction' - result of
predict.glmnet(.., type = "response")
.
The interpretation depends on the model family.
'rowid' - the rownames of newx
'label' - a column of a single label used when merging predictions
Optionally the data.frame will contain:
'classification' - the predicted class (for nominal outcomes).
'reference' - the response being predicted (if newy specified).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.