Skip to contents

Predict anomaly scores using an Isolation Forest model

Usage

# S3 method for class 'isoForest'
predict(
  object,
  newdata,
  num.threads = NULL,
  type = "terminalNodes",
  seed = NULL,
  ...
)

Arguments

object

an Isolation Forest model

newdata

a data frame containing the new observations to be predicted

num.threads

the number of threads to be used for the prediction (default is NULL, which means all available threads)

type

the type of prediction to be made (default is "terminalNodes")

seed

the seed to be used for the random number generator (default is NULL)

...

additional arguments to be passed to the predict function

Value

a data frame containing the anomaly scores for the new observations

Examples

# Load the example data
data(iris)
# Train an Isolation Forest model
model <- isoForest(iris[1:2])
# Predict anomaly scores for new observations
predictions <- predict(model, iris[1:2])