making_predict() is the escape hatch for registering predict methods
when a variant's fn intentionally returns a non-class_stat_infer
object. When fn returns a class_stat_infer subclass, implement
auto_predict() on the result class instead — no registration needed.
Arguments
- obj
A stat function built with
MODEL_FN()(e.g.LINEAR_REG).- model_type
An S7 variable mapper
<var_id>class, orS7::class_formula.
Examples
# Only needed when fn returns a non-class_stat_infer object.
# Prefer implementing auto_predict() on your result class instead.
making_predict(LINEAR_REG, S7::class_formula) %<-% method_predict(
default = function(.x, new_data = NULL, ...) { ... }
)
