RunInvBag: Inverse Bagging algorithm

Description Usage Arguments Value References Examples

Description

The package is an R implementation of the Inverse Bagging algorithm. Given two sets: a training one containing observations from a certain distribution and a testing one which can include as well anomalous observations generated from a different unknown distribution. The algorithm returns scores for the testing set observations relating to their anomalous evidence.

Usage

1
RunInvBag(train, test, Q = NA, Mboot2 = 10000, R = 1)

Arguments

train

data frame - Data generated by a certain distribution (so-called background).

test

data frame - Data mostly generated by the background with possible signal observations.

Q

numeric - Size of sampled sets, which cannot be larger than the test data size

R

numeric - Method for scores computation:

  • 1 - Test statistic score

  • 2 - P-value score

  • 3 - OK scores

Mboot

numeric - Number of sampling iterations.

Value

A numeric vector of scores for respective observations from the test data set.

References

Vischia, P. and Tommaso D., "The Inverse Bagging Algorithm: Anomaly Detection by Inverse Bootstrap Aggregating." EPJ Web of Conferences. Vol. 137. EDP Sciences, 2017.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#Generate multivariate data
require(mvtnorm)
set.seed(1)
n <- 2000
B <- 0.05
P <- 4
train <- rmvnorm(n, sigma = diag(P))

#add anomalies with mean shited from sero
test <- rbind(
 rmvnorm(n*(1-B), sigma = diag(P)), 
 rmvnorm(n*B, mean = rep(2,P),sigma = diag(P))
)

#Compute the score
results <- RunInvBag(train, test)

#Plot results
plot(rersults)

Grzes91/InvBag documentation built on May 9, 2019, 2:19 a.m.