| predict.pbc | R Documentation |
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.
## S3 method for class 'pbc'
predict(object, Xnew, ...)
object |
a fitted object of class |
Xnew |
a numeric matrix of new feature combinations to classify, with the same number of columns as the training data. |
... |
additional arguments (not used). |
A list containing the following components:
a numeric vector of predicted classifications (1 = event,
0 = no event, NA = indeterminate) for each row of Xnew
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
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.