predict.PDEbayes: predict.PDEbayes

View source: R/predict.PDEbayes.R

predict.PDEbayesR Documentation

predict.PDEbayes

Description

Predict a classification with the Pareto Density estimated naive Bayes model (PDENB).

Usage

predict.PDEbayes(object, newdata, type = c("class", "response","prob"), ...)

Arguments

object

Model obtained from training routine in PDEnaiveBayes package.

newdata

[1:n,1:d] matrix of test data. It consists of n cases of d-dimensional data points. Every case has d attributes, variables or features.

type

Optional parameter.

...

Gaussian: Optional: Default=TRUE). Assume gaussian distribution. Plausible: (Optional: TRUE: uses plausble bayesian theorem, FALSE non-plausible bayesian theorem Type: (Optional: default=1, 1 = original PDE, 2 = R native density estimation Threshold: Threshold for which the standard deviation cannot be smaller (default =1e-12) PlotIt: Optional: Default=FALSE, TRUE: Plots Likelihoods PlotCutOff: Optional: Scalar indicating how many features (starting from 1) should be plotted, or a numerical vector specifying the indices of the features to plot. Note: In the second case, avoid selecting too many features, as this may cause the plot to fail ParetoRadiusPerFeauture: Optional [1:d] numerical vector for pareto radii computed priorly, see ParetoRadius or {ParetoRadius_fast} cl: Optional: a cluster object, created by parallel, if given and ParetoRadiusPerFeauture missing, then ParetoRadiusPerFeauture is compputed multicore otherwise single core Robust: Optional: Default=FALSE, TRUE: robust estimation of mean and std in case of Gaussian=TRUE

Details

The function is implemented in a way so that one can combine training and test data although it is intended to be applied on test data only.

Value

Cls

Numeric vector with predicted class associated with newdata.

Author(s)

Michael Thrun

See Also

Train_naiveBayes

Examples

if(requireNamespace("FCPS")){
V=FCPS::ClusterChallenge("Hepta",1000)
Data=V$Hepta
Cls=V$Cls
ind=1:length(Cls)
indtrain=sample(ind,800)
indtest=setdiff(ind,indtrain)

model=Train_naiveBayes(Data[indtrain,],Cls[indtrain],Gaussian=FALSE)
ClsTrain=model$ClsTrain
table(Cls[indtrain],ClsTrain)

ClsTest=predict.PDEbayes(object = model, newdata = Data[indtest,])
table(Cls[indtest],ClsTest)
}

PDEnaiveBayes documentation built on Nov. 17, 2025, 5:07 p.m.