Skip to contents

Applies a fitted cta_tree to new data by routing each observation through the tree until it reaches a leaf node.

Usage

# S3 method for class 'cta_tree'
predict(object, newdata,
  missing_action = c("majority", "na"), ...)

Arguments

object

A cta_tree from oda_cta_fit.

newdata

Data frame or matrix with the same columns as training X.

missing_action

How to handle observations whose split attribute is missing on their traversal path. "majority" (default) routes the observation to the current node's majority class. "na" returns NA_integer_ for that observation (canonical path-local missingness).

...

Unused.

Value

Integer vector of predicted class labels, length nrow(newdata). When missing_action = "na", observations missing a split attribute on their path receive NA_integer_.