Skip to contents

Generates predictions using a unified interface across all classifiers. Dispatches natively on objects of class "classbound". Attempting to call predict() directly on a "classbound_multi" object will result in an error, as multi-model boundaries are evaluated internally by boundary_compute().

Usage

# S3 method for class 'classbound'
predict(object, newdata, predict_args = list(), predfun = NULL, ...)

# S3 method for class 'classbound_multi'
predict(object, newdata, predict_args = list(), predfun = NULL, ...)

Arguments

object

A fitted classbound model. This is the object returned by fit_model() or classbound().

newdata

A data frame of new observations to predict on.

predict_args

A named list of additional arguments passed to predict_adapter.

predfun

A custom function to generate predictions for non-standard models. The function must accept at least two arguments: model (the fitted native model) and newdata (a data frame of new observations). It should return either a vector/factor of predicted classes, or a list containing class (predicted labels) and probs (a probability matrix).

...

Additional arguments passed to the specific model adapter.

Value

A list containing class (a factor of predicted labels) and probs (a probability matrix, or strictly NULL if the classifier lacks probability support). Downstream functions like boundary_compute() are designed to handle probs = NULL gracefully.