Learn R Programming

pmml (version 1.5.7)

pmml.iForest: Generate PMML for an iForest object from the isofor package.

Description

Generate PMML for an iForest object from the isofor package.

Usage

# S3 method for iForest
pmml(model, model.name = "isolationForest_Model",
  app.name = "R", description = "Isolation Forest", copyright = NULL,
  transforms = NULL, unknownValue = NULL, anomalyThreshold = 0.6,
  parentInvalidValueTreatment = "returnInvalid",
  childInvalidValueTreatment = "asIs", ...)

Arguments

model

an iForest object from package isofor

model.name

optional; the model name.

app.name

optional; name where the model was created.

description

optional; description of the model.

copyright

optional; a copyright statement.

transforms

optional; any pre-processing information from the pmmlTransformations package.

unknownValue

optional; a missing value replacement.

anomalyThreshold

double between 0 and 1. Predicted values greater than this are classified as anomalies.

parentInvalidValueTreatment

invalid value treatment at the top MiningField level.

childInvalidValueTreatment

invalid value treatment at the model segment MiningField level.

...

further arguments passed to other methods.

Value

PMML representation of the iForest object.

Details

This function converts the iForest model object to the PMML format. The PMML outputs the anomaly score as well as a boolean value indicating whether the input is an anomaly or not. This is done by simply comparing the anomaly score with anomalyThreshold, a parameter in the pmml function. The iForest function automatically adds an extra level to all categorical variables, labelled "."; this is kept in the PMML representation even though the use of this extra factor in the predict function is unclear.

See Also

pmml, isofor package

Examples

Run this code
# NOT RUN {
# Any anomalous data points in the Iris dataset? Hopefully none of the 
# anomaly scores are high!
library(isofor)
# create an isolation forest with 10 trees. Sample 30 data points at a time
# from the iris dataset to fit the trees
mod <- iForest(iris,nt=10,phi=30)
#convert to PMML
pm <- pmml(mod)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab