predict.outForest: Out-of-Sample Application

Description Usage Arguments Value See Also Examples

View source: R/predict.R

Description

Identify outliers in new data set based on previously fitted 'outForest' object. The result of predict is again an object of type 'outForest'. All its methods can be applied to it.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## S3 method for class 'outForest'
predict(
  object,
  newdata,
  replace = c("pmm", "predictions", "NA", "no"),
  pmm.k = 3,
  threshold = object$threshold,
  max_n_outliers = Inf,
  max_prop_outliers = 1,
  seed = NULL,
  ...
)

Arguments

object

An object of class "outForest".

newdata

A new data.frame to be assessed for numeric outliers.

replace

Should outliers be replaced by predicting mean matching (from the original non-outliers) on the predictions ("pmm", the default), by predictions ("predictions"), by NA ("NA"). Use "no" to keep outliers as they are.

pmm.k

For replace = "pmm", how many nearest prediction neighbours (from the original non-outliers) be considered to sample observed values from?

threshold

Threshold above which an outlier score is considered an outlier.

max_n_outliers

Maximal number of outliers to identify. Will be used in combination with threshold and max_prop_outliers.

max_prop_outliers

Maximal relative count of outliers. Will be used in combination with threshold and max_n_outliers.

seed

Integer random seed.

...

Further arguments passed from other methods.

Value

An object of type outForest.

See Also

outForest, outliers, Data.

Examples

1
2
3
4
5
6
7
8
(out <- outForest(iris, allow_predictions = TRUE))
iris1 <- iris[1, ]
iris1$Sepal.Length <- -1
pred <- predict(out, newdata = iris1)
outliers(pred)
Data(pred)
plot(pred)
plot(pred, what = "scores")

outForest documentation built on Jan. 7, 2021, 9:10 a.m.