pmml.naiveBayes: Generate PMML for naiveBayes objects

Description Usage Arguments Details Author(s) References Examples

Description

Generate the PMML representation for a naiveBayes object from package e1071.

Usage

1
2
3
4
5
## S3 method for class 'naiveBayes'
pmml(model, model.name="naiveBayes_Model", 
      app.name="Rattle/PMML", description="NaiveBayes Model",
      copyright=NULL, transforms=NULL, unknownValue=NULL,
      predictedField, ...)

Arguments

model

a naiveBayes object.

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.

Details

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.

Author(s)

Zementis Inc.

References

  • R project CRAN package:
    e1071: Misc Functions of the Department of Statistics (e1071), TU Wien
    https://CRAN.R-project.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.

Examples

 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)


Search within the pmml package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.