Skip to contents

LOF = mean(lrd(neighbour)) / lrd(x) with reachability smoothing. Neighbour indices are 0-based and come from a STABLE sort of the distance matrix (numpy argsort kind="stable" == order(method="radix")).

Usage

morie_geron_local_outlier_factor(X, k = 5)

Arguments

X

(m, n) data.

k

Neighbours in [1, m-1].

Value

List with lof, lrd, k_distance, neighbors, most_outlying.

Examples

set.seed(4)
X <- rbind(matrix(rnorm(30), 15, 2), c(6, 6))
morie_geron_local_outlier_factor(X, k = 5)
#> $lof
#>  [1] 0.9240780 0.9727813 1.0396713 1.0679457 1.0285568 0.9318683 1.4921518
#>  [8] 0.9633543 1.3455137 1.2005191 1.0984335 1.0131661 0.9672337 1.0317579
#> [15] 1.0158251 6.3457652
#> 
#> $lrd
#>  [1] 0.9915393 0.9923091 0.8661492 0.8447289 0.8164332 1.0389617 0.6535983
#>  [8] 1.0666004 0.6679773 0.7093952 0.7869270 1.0228065 1.0629236 0.8030843
#> [15] 1.0205696 0.1418214
#> 
#> $k_distance
#>  [1] 1.0865735 1.2431706 1.0809029 1.0469252 1.4892625 1.2333990 1.6946328
#>  [8] 0.9320625 1.6692129 1.4293870 1.0690136 0.7313435 0.7592493 1.6501657
#> [15] 0.7206287 7.6318304
#> 
#> $neighbors
#>       [,1] [,2] [,3] [,4] [,5]
#>  [1,]    3   10    2   12   14
#>  [2,]    7   11   14   12    6
#>  [3,]    3   10    0    4   12
#>  [4,]   10    2    0   12   13
#>  [5,]    2    9    3   10    0
#>  [6,]   12   14   11    7    8
#>  [7,]    1    0    7   13   11
#>  [8,]   11   14    1   12    5
#>  [9,]    9    5   12    4    2
#> [10,]    8    4    2    3   12
#> [11,]    3    2    0   13    4
#> [12,]   14    7   12    1    5
#> [13,]   14   11    5    7    0
#> [14,]   10    3    0    2    6
#> [15,]   11    7   12    1    5
#> [16,]    8    9    5   12   14
#> 
#> $most_outlying
#> [1] 15
#> 
#> $k
#> [1] 5
#> 
#> $estimate
#>  [1] 0.9240780 0.9727813 1.0396713 1.0679457 1.0285568 0.9318683 1.4921518
#>  [8] 0.9633543 1.3455137 1.2005191 1.0984335 1.0131661 0.9672337 1.0317579
#> [15] 1.0158251 6.3457652
#> 
#> $n
#> [1] 16
#>