auto_predict() is the protocol generic for producing predictions from
result objects produced by fn in baseline() and variant(). It is
called automatically by predict() when the result stored in
cld_exec@data is a class_stat_infer subclass.
Arguments
- x
A
class_stat_infersubclass object, typicallycld_exec@data.- new_data
A data frame.
NULLdefaults to the training data.- ...
Passed to the dispatched method. Methods typically accept a
new_dataargument (a data frame;NULLdefaults to the training data) plus any method-specific options — see the individual result class's documentation (e.g.?class_lm_object) for what it accepts.
Details
Register a method on your output class to participate:
S7::method(auto_predict, my_model_result) = function(x, new_data = NULL, ...) {
tibble::tibble(.pred = ...)
}A variant whose fn returns the same result class as baseline
inherits auto_predict() for free via S7's parent chain.
