predict.bagged.outliertrees: Predict method for Bagged OutlierTrees

Description Usage Arguments Value See Also Examples

View source: R/predict.bagged.outliertrees.R

Description

Predict method for Bagged OutlierTrees

Usage

1
2
3
4
5
6
7
8
## S3 method for class 'bagged.outliertrees'
predict(
  object,
  newdata,
  min_outlier_score = 0.95,
  nthreads = parallel::detectCores(),
  ...
)

Arguments

object

A Bagged OutlierTrees object as returned by bagged.outliertrees.

newdata

A Data Frame in which to look for outliers according to the fitted model.

min_outlier_score

Minimum outlier score to use when finding outliers.

nthreads

Number of threads to use when predicting.

...

No use.

Value

Will return a list of lists with the outliers and their information (each row is an entry in the first list, with the same names as the rows in the input data frame), which can be printed into a human-readable format after-the-fact through functions print.

See Also

bagged.outliertrees print.bagged.outlieroutputs

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
library(bagged.outliertrees)

### example dataset with interesting outliers
data(hypothyroid)

### fit a Bagged OutlierTrees model
model <- bagged.outliertrees(hypothyroid,
  ntrees = 10,
  subsampling_rate = 0.5,
  z_outlier = 6,
  nthreads = 1
)

### use the fitted model to find outliers in the training dataset
outliers <- predict(model,
  newdata = hypothyroid,
  min_outlier_score = 0.5,
  nthreads = 1
)

### print the top-10 outliers in human-readable format
print(outliers, outliers_print = 10)

bagged.outliertrees documentation built on July 6, 2021, 9:06 a.m.