View source: R/adjust-predictions-custom.R
adjust_predictions_custom | R Documentation |
This adjustment functions allows for arbitrary transformations of model
predictions using dplyr::mutate()
statements.
adjust_predictions_custom(x, ..., .pkgs = character(0))
x |
A |
... |
Name-value pairs of expressions. See |
.pkgs |
A character string of extra packages that are needed to execute the commands. |
An updated tailor()
containing the new operation.
Note that custom adjustments should not carry out estimation. If they do,
the estimation steps will be carried out independently at fit()
and predict()
time. For example, if your transformation includes a mean
shift, the postprocessor will take the mean of the column supplied in the
training data at fit()
and, rather than reusing that mean at predict()
will take the mean again of the dataset supplied at predict()
time.
This adjustment doesn't require estimation and, as such, the same data that's
used to train it with fit()
can be predicted on with predict()
; fitting
this adjustment just collects metadata on the supplied column names and does
not risk data leakage.
library(modeldata)
head(two_class_example)
tlr <-
tailor() |>
adjust_equivocal_zone() |>
adjust_predictions_custom(linear_predictor = binomial()$linkfun(Class2))
tlr_fit <- fit(
tlr,
two_class_example,
outcome = c(truth),
estimate = c(predicted),
probabilities = c(Class1, Class2)
)
predict(tlr_fit, two_class_example) |> head()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.