Skip to contents

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.

Usage

making_predict(obj, model_type)

Arguments

obj

A stat function built with MODEL_FN() (e.g. LINEAR_REG).

model_type

An S7 variable mapper <var_id> class, or S7::class_formula.

Value

A making_predict_call object, consumed by %<-%.

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, ...) { ... }
)