Generate the PMML representation for a naiveBayes object from package e1071.
1 2 3 4 5 
model 
a 
model.name 
a name to be given to the model in the PMML code. 
app.name 
the name of the application that generated the PMML code. 
description 
a descriptive text for the Header element of the PMML code. 
copyright 
the copyright notice for the model. 
transforms 
data transformations represented in PMML via pmmlTransformations. 
unknownValue 
value to be used as the 'missingValueReplacement' attribute for all MiningFields. 
predictedField 
Required parameter; the name of the predicted field. 
... 
further arguments passed to or from other methods. 
The PMML representation of the NaiveBayes model implements the definition as specified by the Data Mining Group: intermediate probability values which are less than the threshold value are replaced by the threshold value. This is different from the prediction function of the e1071 in which only probability values of 0 and standard deviations of continuous variables of with the value 0 are replaced by the threshold value. The two values will therefore not match exactly for cases involving very small probabilities.
Zementis Inc. info@zementis.com
R project CRAN package:
e1071: Misc Functions of the Department of Statistics (e1071), TU Wien
https://CRAN.Rproject.org/package=e1071
A. Guazzelli, T. Jena, W. Lin, M. Zeller (2013). Extending the Naive Bayes Model Element in PMML: Adding Support for Continuous Input Variables. In Proceedings of the 19th ACM SIGKDD Conference on Knowledge Discovery and Data Mining.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  # Build a simple Naive Bayes model
# Upload the required library
library(e1071)
library(pmml)
# download an example dataset
data(houseVotes84)
house < na.omit(houseVotes84)
# Construct an example model defining a threshold value of 0.003
model<naiveBayes(Class~V1+V2+V3,data=house,threshold=0.003)
# Output the PMML representation
pmml(model,dataset=house,predictedField="Class")
rm(model)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.