predict.pbc: Predict Method for Projective Bayes Classifier

View source: R/fun.R

predict.pbcR Documentation

Predict Method for Projective Bayes Classifier

Description

Generates predictions from a fitted projective Bayes classifier for new feature combinations. Exact matches to training feature combinations are classified directly from the fitted classifier. For unobserved feature combinations, monotonicity constraints are used to impute the classification when the new combination is bounded from above or below by training combinations with a determinate classification. Combinations that cannot be classified by monotonicity constraints alone are flagged as indeterminate.

Usage

## S3 method for class 'pbc'
predict(object, Xnew, ...)

Arguments

object

a fitted object of class "pbc", produced by PBclassifier.

Xnew

a numeric matrix of new feature combinations to classify, with the same number of columns as the training data.

...

additional arguments (not used).

Value

A list containing the following components:

fit

a numeric vector of predicted classifications (1 = event, 0 = no event, NA = indeterminate) for each row of Xnew

msg

a character vector describing how each prediction was obtained: "exact match" for training combinations, "bound from below" or "bound from above" for combinations classified by monotonicity constraints, and "Unsure - need more training data" for indeterminate cases

Examples

A <- as.matrix(expand.grid(rep(list(0:1), 6)))
set.seed(2025)
X <- A[sample(nrow(A), size=500, replace=TRUE),]
y <- as.numeric(rowSums(X) >= 3)
fit <- PBclassifier(X, y)
predict(fit, X)

McMiso documentation built on April 4, 2026, 1:07 a.m.

Related to predict.pbc in McMiso...