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

View source: R/pmml.iForest.R

pmml.iForestR Documentation

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 class 'iForest'
pmml(
  model,
  model_name = "isolationForest_Model",
  app_name = "SoftwareAG PMML Generator",
  description = "Isolation Forest Model",
  copyright = NULL,
  model_version = NULL,
  transforms = NULL,
  missing_value_replacement = NULL,
  anomaly_threshold = 0.6,
  parent_invalid_value_treatment = "returnInvalid",
  child_invalid_value_treatment = "asIs",
  ...
)

Arguments

model

An iForest object from package isofor.

model_name

A name to be given to the PMML model.

app_name

The name of the application that generated the PMML.

description

A descriptive text for the Header element of the PMML.

copyright

The copyright notice for the model.

model_version

A string specifying the model version.

transforms

Data transformations.

missing_value_replacement

Value to be used as the 'missingValueReplacement' attribute for all MiningFields.

anomaly_threshold

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

parent_invalid_value_treatment

Invalid value treatment at the top MiningField level.

child_invalid_value_treatment

Invalid value treatment at the model segment MiningField level.

...

Further arguments passed to or from other methods.

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 anomaly_threshold, 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.

Value

PMML representation of the iForest object.

Author(s)

Tridivesh Jena

References

isofor package on GitHub

See Also

pmml

Examples

## Not run: 

# Build iForest model using iris dataset. Create an isolation
# forest with 10 trees. Sample 30 data points at a time from
# the iris dataset to fit the trees.
library(isofor)
data(iris)
mod <- iForest(iris, nt = 10, phi = 30)

# Convert to PMML:
mod_pmml <- pmml(mod)

## End(Not run)


pmml documentation built on March 18, 2022, 5:49 p.m.