# LOOP: Local Outlier Probability (LOOP) algorithm In DDoutlier: Distance & Density-Based Outlier Detection

## Description

Function to calculate the Local Outlier Probability (LOOP) as an outlier score for observations. Suggested by Kriegel, H.-P., Kröger, P., Schubert, E., & Zimek, A. (2009)

## Usage

 `1` ```LOOP(dataset, k = 5, lambda = 3) ```

## Arguments

 `dataset` The dataset for which observations have a LOOP score returned `k` The number of k-nearest neighbors to compare density with `lambda` Multiplication factor for standard deviation. The greater lambda, the smoother results. Default is 3 as used in original papers experiments

## Details

LOOP computes a local density based on probabilistic set distance for observations, with a user-given k-nearest neighbors. The density is compared to the density of the respective nearest neighbors, resulting in the local outlier probability. The values ranges from 0 to 1, with 1 being the greatest outlierness. A kd-tree is used for kNN computation, using the kNN() function from the 'dbscan' package. The LOOP function is useful for outlier detection in clustering and other multidimensional domains

## Value

A vector of LOOP scores for observations. 1 indicates outlierness and 0 indicate inlierness

## References

Kriegel, H.-P., Kröger, P., Schubert, E., & Zimek, A. (2009). LoOP: Local Outlier Probabilities. In ACM Conference on Information and Knowledge Management, CIKM 2009, Hong Kong, China. pp. 1649-1652. DOI: 10.1145/1645953.1646195

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12``` ```# Create dataset X <- iris[,1:4] # Find outliers by setting an optional k outlier_score <- LOOP(dataset=X, k=10, lambda=3) # Sort and find index for most outlying observations names(outlier_score) <- 1:nrow(X) sort(outlier_score, decreasing = TRUE) # Inspect the distribution of outlier scores hist(outlier_score) ```

### Example output

```         42          23         107          14          16          25
0.936235418 0.773293482 0.745985621 0.589744874 0.586207057 0.547829870
99          44         115         109         135          63
0.473909911 0.460917905 0.447284155 0.395413064 0.395281509 0.390668087
45         132          60          15         119          61
0.388528610 0.386350112 0.381010565 0.380288212 0.375649386 0.374856638
80          24          33          37          36          85
0.359418608 0.352309313 0.349816427 0.347512860 0.347218415 0.344395886
21         118         101          69          58          65
0.340537014 0.335931452 0.334369942 0.330427980 0.319320580 0.307373705
26         110          94           7          19         120
0.301971937 0.287307483 0.281688962 0.277729412 0.269540000 0.269130748
130           9          38          88          86          51
0.268525183 0.259597736 0.256941436 0.254001561 0.245956522 0.239546570
149         142          32          91          72          53
0.237211160 0.232868294 0.207345522 0.202257878 0.193636419 0.163476997
20          54          57         126         114          34
0.140228789 0.139833437 0.135078667 0.126182512 0.125330986 0.123724899
74          67          68          39         137         122
0.122223977 0.120802321 0.117716381 0.109209009 0.106387188 0.101191249
78          82         147          43          17         136
0.096294402 0.095803081 0.090993339 0.090498848 0.087338896 0.087113616
71         123          41         134          12          27
0.086457913 0.083747574 0.070724734 0.070178971 0.066923954 0.064599193
111         108          22          89          49          62
0.062053651 0.061418371 0.059202167 0.059060506 0.054719850 0.049116040
77         133         138           6         146         104
0.048266840 0.044655165 0.032020039 0.031071969 0.022247127 0.018822273
47         131          75         116          46          81
0.018388101 0.016851085 0.012537963 0.010731342 0.008831521 0.007390367
145          55          50         105           1           2
0.006810598 0.002752395 0.001602346 0.001244878 0.000000000 0.000000000
3           4           5           8          10          11
0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
13          18          28          29          30          31
0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
35          40          48          52          56          59
0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
64          66          70          73          76          79
0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
83          84          87          90          92          93
0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
95          96          97          98         100         102
0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
103         106         112         113         117         121
0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
124         125         127         128         129         139
0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
140         141         143         144         148         150
0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
```

DDoutlier documentation built on May 1, 2019, 10:20 p.m.