Skip to contents

Applies the learned selected-step sequence to newdata. For each observation, steps are applied in order; the first step whose rule classifies the observation is authoritative. Observations not classified by any step are returned as NA (resolved = FALSE).

Usage

# S3 method for class 'sda_fit'
predict(object, newdata, type = "class", ...)

Arguments

object

A sda_fit object.

newdata

Data frame or matrix. Must contain columns with names matching all selected attributes in object$selected_attributes. Extra columns are ignored (wide-newdata is supported).

type

Output type. One of "class" (default), "stage", "rule", or "trace". "propensity" and "weights" are reserved for SDA-5 and error in SDA-1.

...

Unused.

Value

"class"

Integer vector of predicted class labels; NA for unresolved observations.

"stage"

Integer vector of step_id at which each observation was classified; NA for unresolved.

"rule"

Character vector of the selected attribute name at the classifying step; NA for unresolved.

"trace"

Data frame with one row per observation x step: obs_id, step_id, attribute, classified, class_pred.

Details

This is sequential selected-step application - it follows the learned SDA structure, not a re-scan of X. It does not select a "first attribute" from newdata; it replays object$steps[[1]], object$steps[[2]], ... in the order established at fit time.