Similar to other predict methods, this function predicts fitted values from a fitted "hanaml.IsolationForest" object.

# S3 method for IsolationForest
predict(
  model,
  data,
  key = NULL,
  features = NULL,
  contamination = NULL,
  thread.ratio = NULL
)

Format

S3 methods

Arguments

model

R6Class object
A "hanaml.IsolationForest" object for prediction.

data

DataFrame
Input data which includes key and feature columns.

key

character, optional
Name of the ID column.
Defaults to the first column if not provided.

features

character of list of characters, optional
Name of feature columns.
If not provided, it defaults all non-key columns of data.

contamination

numeric, optional
The proportion of outliers in the data set. Should be in the range (0, 0.5].
Defaults to 0.1.

thread.ratio

numeric, optional
The ratio of available threads.

  • 0: single thread.

  • 0~1: percentage.

  • Others: heuristically determined.

Defaults to -1.

Value

A hanaml.DataFrame which is the aggregated forecasted values.

Examples

Input DataFrame data:


> data$Collect()
  ID   V000  V001
1  0   -2.0  -1.0
2  1   -1.0  -1.0
3  2   -1.0  -2.0
4  3    1.0   1.0
5  4    1.0   2.0
6  5    2.0   1.0
7  6    6.0   3.0
8  7   -4.0   7.0

Call the predict function with a "hanaml.IsolationForest" object isof and obtain the result:


> res <- predict(isof,
                 data,
                 key='ID',
                 features=list('V000', 'V001'),
                 contamination=0.25)

Print the output:


> res$Collect()
  ID     SCORE  LABEL
1  0  0.446897      1
2  1  0.411048      1
3  2  0.498931      1
4  3  0.407796      1
5  4  0.423264      1
6  5  0.443270      1
7  6  0.619513     -1
8  7  0.638874     -1