safe_predict.glmnet: Safe predictions for glmnet objects

Description Usage Arguments Value

Description

Safe predictions for glmnet objects

Usage

1
2
3
## S3 method for class 'glmnet'
safe_predict(object, new_data, type = c("response",
  "class", "prob", "link"), ..., penalty = NULL, threshold = 0.5)

Arguments

object

TODO

new_data

TODO

type

TODO

...

Unused. safe_predict() checks that all arguments in ... are evaluated via the ellipsis package. The idea is to prevent silent errors when arguments are mispelled. This feature is experimental and feedback is welcome.

penalty

Unlike safe_predict.cv.glmnet(), here you can explicitly set a value of penalty. In the CV version you have to pick one of the cross-validated versions of the penalty.

threshold

A number between 0 and 1 to use as a threshold for classification. When the class probability for the class corresponding to a positive event is greater than the threshold, the event will be classified as positive. Defaults to 0.5.

Value

A tibble::tibble() with one row for each row of new_data. Predictions for observations with missing data will be NA. Returned tibble has different columns depending on type:

If you request standard errors with std_error = TRUE, an additional column .std_error.

For interval predictions, the tibble has additional attributes level and interval. The level is the same as the level argument and is between 0 and 1. interval is either "confidence" or "prediction". Some models may also set a method attribute to detail the method used to calculate the intervals.


alexpghayes/safepredict documentation built on May 29, 2019, 11:02 p.m.