View source: R/predict.PDEbayes.R
| predict.PDEbayes | R Documentation |
Predict a classification with the Pareto Density estimated naive Bayes model (PDENB).
predict.PDEbayes(object, newdata, type = c("class", "response","prob"), ...)
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. |
... |
|
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.
Cls |
Numeric vector with predicted class associated with newdata. |
Michael Thrun
Train_naiveBayes
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)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.