[IEEE 2009 47th Annual Allerton Conference on Communication, Control, and Computing (Allerton) -...

8
Outlier Detection via Localized p-value Estimation Manqi Zhao and Venkatesh Saligrama Abstract—We propose a novel non-parametric adaptive out- lier detection algorithm, called LPE, for high dimensional data based on score functions derived from nearest neighbor graphs on n-point nominal data. Outliers are predicted whenever the score of a test sample falls below α, which is supposed to be the desired false alarm level. The resulting outlier detector is shown to be asymptotically optimal in that it is uniformly most powerful for the specified false alarm level, α, for the case when the density associated with the outliers is a mixture of the nominal and a known density. Our algorithm is computationally efficient, being linear in dimension and quadratic in data size. The whole empirical Receiving Operating Characteristics (ROC) curve can be derived with almost no additional cost based on the estimated score function. It does not require choosing complicated tuning parameters or function approximation classes and it can adapt to local structure such as local change in dimensionality by incorporating the technique of manifold learning. We demonstrate the algorithm on both artificial and real data sets in high dimensional feature spaces. I. I NTRODUCTION Outlier detection involves detecting statistically significant deviations of test data from nominal distribution. Adopting a hypothesis testing perspective, we formulate this problem as H 0 : η f 0 vs. H 1 : η f 1 where the only information available comes from the training set {x 1 , ··· ,x n } whose elements are all drawn from the nominal distribution f 0 . The test point η is modeled as drawn from the mixture distribution f × (η) = (1 π)f 0 (η)+ πf 1 (η) where π is the mixture weight (also unknown). In typical applications the nominal distribution is unknown and generally cannot be reliably estimated from nominal training data due to a combination of factors such as limited data size and high dimensionality. Outlier detection has been extensively studied. It is also re- ferred to as novelty detection [1], [2], anomaly detection [3], one-class classification [4], [5] and single-class classification [6] in the literature. Approaches to outlier detection can be grouped into several categories. In parametric approaches [7] the nominal densities are assumed to come from a param- eterized family and generalized likelihood ratio tests are used for detecting deviations from nominal. It is difficult to use parametric approaches when the distribution is unknown and data is limited. A K-nearest neighbor (K-NN) outlier detection approach is presented in [8], [9]. There an outlier is declared whenever the distance to the K-th nearest neighbor of the test sample falls outside a threshold. In comparison our outlier detector utilizes the global information available from the entire K-NN graph to detect deviations from the nominal. The authors are with the Department of Electrical and Computer Engineering, Boston University, Boston, MA 02215, USA {mqzhao, srv}@bu.edu In addition it has provable optimality properties. Learning theoretic approaches attempt to find decision regions, based on nominal data, that separate nominal instances from their outliers. These include one-class SVM of Sch¨olkopf et. al. [10] where the basic idea is to map the training data into the kernel space and to separate them from the origin with maximum margin. Other algorithms along this line of research include support vector data description [11], linear programming approach [1], and single class minimax probability machine [12]. While these approaches provide impressive computationally efficient solutions on real data, it is generally difficult to precisely relate tuning parameter choices to desired false alarm probability. Scott and Nowak [13] derive decision regions based on minimum volume (MV) sets, which does provide Type I and Type II error control. They approximate (in appropriate function classes) level sets of the unknown nominal mul- tivariate density from training samples. Related work by Hero [3] based on geometric entropic minimization (GEM) detects outliers by comparing test samples to the most concentrated subset of points in the training sample. This most concentrated set is the K-point minimum spanning tree(MST) for n-point nominal data and converges asymp- totically to the minimum entropy set (which is also the MV set). Nevertheless, computing K-MST for n-point data is generally intractable. To overcome these computational limitations [3] proposes heuristic greedy algorithms based on leave-one out K-NN graph, which while inspired by K- MST algorithm is no longer provably optimal. A. Our Contribution Our approach is related to these latter techniques discussed above, namely, MV sets of [13] and GEM approach of [3]. We propose an adaptive non-parametric method for outlier detection based on score functions that maps data samples to the interval [0, 1]. Our score function is derived from a K-nearest neighbor graph (K-NNG) on n-point nominal data. Outlier is declared whenever the score of a test sample falls below α (the desired false alarm error). The efficacy of our method rests upon its close connection to multivariate p-values. In statistical hypothesis testing, p-value is any transformation of the feature space to the interval [0, 1] that induces a uniform distribution on the nominal data. When test samples with p-values smaller than α are declared as anomalies, false alarm error is less than α. We develop a novel notion of p-values based on measures of level sets of likelihood ratio functions. Our notion provides a characterization of the optimal outlier detector, in that, it is uniformly most powerful for a specified false alarm Forty-Seventh Annual Allerton Conference Allerton House, UIUC, Illinois, USA September 30 - October 2, 2009 978-1-4244-5871-4/09/$26.00 ©2009 IEEE 1482

Transcript of [IEEE 2009 47th Annual Allerton Conference on Communication, Control, and Computing (Allerton) -...

Outlier Detection via Localized p-value Estimation

Manqi Zhao and Venkatesh Saligrama

Abstract— We propose a novel non-parametric adaptive out-lier detection algorithm, called LPE, for high dimensional databased on score functions derived from nearest neighbor graphson n-point nominal data. Outliers are predicted wheneverthe score of a test sample falls below α, which is supposedto be the desired false alarm level. The resulting outlierdetector is shown to be asymptotically optimal in that it isuniformly most powerful for the specified false alarm level, α,for the case when the density associated with the outliers is amixture of the nominal and a known density. Our algorithmis computationally efficient, being linear in dimension andquadratic in data size. The whole empirical Receiving OperatingCharacteristics (ROC) curve can be derived with almost noadditional cost based on the estimated score function. It doesnot require choosing complicated tuning parameters or functionapproximation classes and it can adapt to local structure such aslocal change in dimensionality by incorporating the techniqueof manifold learning. We demonstrate the algorithm on bothartificial and real data sets in high dimensional feature spaces.

I. INTRODUCTION

Outlier detection involves detecting statistically significant

deviations of test data from nominal distribution. Adopting

a hypothesis testing perspective, we formulate this problem

as H0 : η ∼ f0 vs. H1 : η ∼ f1 where the only information

available comes from the training set x1, · · · , xn whose

elements are all drawn from the nominal distribution f0.

The test point η is modeled as drawn from the mixture

distribution f×(η) = (1 − π)f0(η) + πf1(η) where π is

the mixture weight (also unknown). In typical applications

the nominal distribution is unknown and generally cannot

be reliably estimated from nominal training data due to a

combination of factors such as limited data size and high

dimensionality.

Outlier detection has been extensively studied. It is also re-

ferred to as novelty detection [1], [2], anomaly detection [3],

one-class classification [4], [5] and single-class classification

[6] in the literature. Approaches to outlier detection can be

grouped into several categories. In parametric approaches [7]

the nominal densities are assumed to come from a param-

eterized family and generalized likelihood ratio tests are

used for detecting deviations from nominal. It is difficult to

use parametric approaches when the distribution is unknown

and data is limited. A K-nearest neighbor (K-NN) outlier

detection approach is presented in [8], [9]. There an outlier is

declared whenever the distance to the K-th nearest neighbor

of the test sample falls outside a threshold. In comparison our

outlier detector utilizes the global information available from

the entire K-NN graph to detect deviations from the nominal.

The authors are with the Department of Electrical and ComputerEngineering, Boston University, Boston, MA 02215, USA mqzhao,[email protected]

In addition it has provable optimality properties. Learning

theoretic approaches attempt to find decision regions, based

on nominal data, that separate nominal instances from their

outliers. These include one-class SVM of Scholkopf et.

al. [10] where the basic idea is to map the training data

into the kernel space and to separate them from the origin

with maximum margin. Other algorithms along this line

of research include support vector data description [11],

linear programming approach [1], and single class minimax

probability machine [12]. While these approaches provide

impressive computationally efficient solutions on real data,

it is generally difficult to precisely relate tuning parameter

choices to desired false alarm probability.

Scott and Nowak [13] derive decision regions based on

minimum volume (MV) sets, which does provide Type I

and Type II error control. They approximate (in appropriate

function classes) level sets of the unknown nominal mul-

tivariate density from training samples. Related work by

Hero [3] based on geometric entropic minimization (GEM)

detects outliers by comparing test samples to the most

concentrated subset of points in the training sample. This

most concentrated set is the K-point minimum spanning

tree(MST) for n-point nominal data and converges asymp-

totically to the minimum entropy set (which is also the

MV set). Nevertheless, computing K-MST for n-point data

is generally intractable. To overcome these computational

limitations [3] proposes heuristic greedy algorithms based

on leave-one out K-NN graph, which while inspired by K-

MST algorithm is no longer provably optimal.

A. Our Contribution

Our approach is related to these latter techniques discussed

above, namely, MV sets of [13] and GEM approach of [3].

We propose an adaptive non-parametric method for outlier

detection based on score functions that maps data samples

to the interval [0, 1]. Our score function is derived from

a K-nearest neighbor graph (K-NNG) on n-point nominal

data. Outlier is declared whenever the score of a test sample

falls below α (the desired false alarm error). The efficacy of

our method rests upon its close connection to multivariate

p-values. In statistical hypothesis testing, p-value is any

transformation of the feature space to the interval [0, 1] that

induces a uniform distribution on the nominal data. When

test samples with p-values smaller than α are declared as

anomalies, false alarm error is less than α.

We develop a novel notion of p-values based on measures

of level sets of likelihood ratio functions. Our notion provides

a characterization of the optimal outlier detector, in that,

it is uniformly most powerful for a specified false alarm

Forty-Seventh Annual Allerton ConferenceAllerton House, UIUC, Illinois, USASeptember 30 - October 2, 2009

978-1-4244-5871-4/09/$26.00 ©2009 IEEE 1482

level for the case when the anomaly density is a mixture of

the nominal and a known density. We show that our score

function is asymptotically consistent, namely, it converges to

our multivariate p-value as data length approaches infinity.

Our approach bridges the gap between the algorithm (one-

class SVM) and the theory (MV-set) because our score

function on K-NNG turns out to be the empirical estimates

of the volume of the MV sets containing the test point. The

volume, which is a real number, is a sufficient statistic for

ensuring optimal guarantees. In this way we avoid explicit

high-dimensional level set computation. Yet our algorithms

lead to statistically optimal solutions with the ability to

control false alarm and miss error probabilities.

Important features of our outlier detector are summarized.

(1) Like [3] our algorithm scales linearly with dimension

and quadratic with data size and can be applied to high

dimensional feature spaces. (2) Like [13] our algorithm is

provably optimal in that it is uniformly most powerful for the

specified false alarm level, α, for the case that the anomaly

density is a mixture of the nominal and any other density

(not necessarily uniform). (3) We do not require assumptions

of linearity, smoothness, continuity of the densities or the

convexity of the level sets. Furthermore, our algorithm adapts

to the inherent manifold structure or local dimensionality of

the nominal density (see Section III-A). (4) Like [3] and

unlike other learning theoretic approaches such as [10], [13]

we do not require choosing complex tuning parameters or

function approximation classes. (5) The convergence rate of

our algorithm is only dependent on the intrinsic dimension

of the dataset (see Section III-B).

The rest of the paper is organized as follows. In Section

II we introduce the our algorithm, called localized p-value

estimation. The analysis of the algorithm is presented in

Section III where we prove that our p-value estimator is

consistent. In Section IV, we present the experiment results

on both synthetic and real-world datasets. Finally we close

with a brief discussion in Section V.

II. OUTLIER DETECTION ALGORITHM: LPE

In this section we present our basic algorithm devoid

of any statistical context. Statistical analysis appears in

Section III. Let S = x1, x2, · · · , xn be the nominal

training set of size n belonging to the unit cube [0, 1]d. For

notational convenience we use η and xn+1 interchangeably

to denote a test point. Our task is to declare whether the test

point is consistent with nominal data or deviates from the

nominal data. If the test point is an anomaly it is assumed to

come from a mixture of nominal distribution underlying the

training data and another known density (see Section III).

Let d(x, y) be a distance function denoting the distance be-

tween any two points x, y ∈ [0, 1]d. For simplicity we denote

the distances by dij = d(xi, xj). In the simplest case we as-

sume the distance metric to be Euclidean. However, we also

consider geodesic distances to exploit the underlying mani-

fold structure. The geodesic distance is defined as the shortest

distance on the manifold. A subroutine in Isomap [14] can

be used to efficiently and consistently estimate the geodesic

distances. In addition by means of selective weighting of

different coordinates the distance function could also account

for pronounced changes in local dimensionality. This can

be accomplished for instance through a by product of local

linear embedding [16]. However, we temporarily skip these

details here and assume that a suitable distance metric is

chosen. We will elaborate on this topic in Section III-A.

Once a distance function is defined our next step is to

form a K nearest neighbor graph (K-NNG) or alternatively

an ǫ neighbor graph (ǫ-NG). K-NNG is formed by connecting

each xi to the K closest points xi1 , · · · , xiK in S −xi.

We then sort the K nearest distances for each xi in increasing

order di,i1 ≤ · · · ≤ di,iKand denote RS(xi) = di,iK

, that

is, the distance from xi to its K-th nearest neighbor. We

construct ǫ-NG where xi and xj are connected if and only

if dij ≤ ǫ. In this case we define NS(xi) as the degree of

point xi in the ǫ-NG.

For the simple case when the anomalous density is an arbi-

trary mixture of nominal and uniform density1 we consider

the following two score functions associated with the two

graphs K-NNG and ǫ-NNG respectively. The score functions

map the test data η to the interval [0, 1].

K-LPE: pK(η) =1

n

n∑

i=1

IRS(η)≤RS(xi) (1)

ǫ-LPE: pǫ(η) =1

n

n∑

i=1

INS(η)≥NS(xi) (2)

where I· is the indicator function.

Finally, given a pre-defined significance level α (e.g.,

0.05), we declare η to be anomalous if pK(η), pǫ(η) ≤ α.

We call this algorithm Localized p-value Estimation (LPE)

algorithm. This choice is motivated by its close connection

to multivariate p-values(see Section III).

The score function K-LPE (or ǫ-LPE) measures the rel-

ative concentration of point η compared to the training set.

Section III establishes that the scores for nominally generated

data is asymptotically uniformly distributed in [0, 1]. Scores

for anomalous data are clustered around 0. Hence when

scores below level α are declared as anomalous the false

alarm error is smaller than α asymptotically (since the

integral of a uniform distribution from 0 to α is α).

Figure 1 illustrates the use of K-LPE algorithm for outlier

detection when the nominal data is a 2D Gaussian mixture.

The middle panel of figure 1 shows the detection results

based on K-LPE are consistent with the theoretical contour

for significance level α = 0.05. The right panel of figure

1 shows the empirical distribution (derived from the kernel

density estimation) of the score function K-LPE for the

nominal (solid blue) and the anomaly (dashed red) data. We

can see that the curve for the nominal data is approximately

uniform in the interval [0, 1] and the curve for the anomaly

data has a peak at 0. Therefore choosing the threshold

1When the mixing density is not uniform but, say f1, the score functions must be

modified to pK(η) = 1n

∑ ni=1 I

1f1(η)RS(η)

≤ 1f1(xi)RS(xi)

and pǫ(η) =

1n

∑ ni=1 I

NS(η)f1(η)

≥NS(xi)f1(xi)

for the two graphs K-NNG and ǫ-NNG respectively.

1483

Bivariate Gaussian mixture distribution

−6 −4 −2 0 2 4−6

−5

−4

−3

−2

−1

0

1

2

3

4

5

anomaly detection via K−LPE, n=200, K=6, α=0.05

−6 −4 −2 0 2 4−6

−5

−4

−3

−2

−1

0

1

2

3

4

5

level set at α=0.05

labeled as anomaly

labeled as nominal

0 0.2 0.4 0.6 0.8 10

2

4

6

8

10

12empirical distribution of the scoring function K−LPE

value of K−LPE

em

piric

al density

nominal data

anomaly data

α=0.05

Fig. 1. Left: Level sets of the nominal bivariate Gaussian mixture distribution used to illustrate the K-LPE algorithm. Middle: Results ofK-LPE with K = 6 and Euclidean distance metric for m = 150 test points drawn from a equal mixture of 2D uniform and the (nominal)bivariate distributions. Scores for the test points are based on 200 nominal training samples. Scores falling below a threshold level 0.05are declared as anomalies. The dotted contour corresponds to the exact bivariate Gaussian density level set at level α = 0.05. Right: Theempirical distribution of the test point scores associated with the bivariate Gaussian appear to be uniform while scores for the test pointsdrawn from 2D uniform distribution cluster around zero.

α = 0.05 will approximately control the Type I error within

0.05 and minimize the Type II error. We also take note of

the inherent robustness of our algorithm. As seen from the

figure (right) small changes in α lead to small changes in

actual false alarm and miss levels.

To summarize the above discussion, our LPE algorithm

has three steps:

(1) Inputs: Significance level α, distance metric (Euclidean,

geodesic, weighted etc.).

(2) Score computation: Construct K-NNG (or ǫ-NG) based

on dij and compute the score function K-LPE from Equation

1 (or ǫ-LPE from Equation 2).

(3) Make Decision: Declare η to be anomalous if and only

if pK(η) ≤ α (or pǫ(η) ≤ α).

Computational Complexity: To compute each pairwise dis-

tance requires O(d) operations; and O(n2d) operations for all

the nodes in the training set. In the worst-case computing the

K-NN graph (for small K) and the functions RS(·), NS(·)requires O(n2) operations over all the nodes in the training

data. Finally, computing the score for each test data requires

O(nd+n) operations(given that RS(·), NS(·) have already

been computed).

Remark: LPE is fundamentally different from non-

parametric density estimation or level set estimation schemes

(e.g., MV-set). These approaches involve explicit estimation

of high dimensional quantities and thus hard to apply in

high dimensional problems. By computing scores for each

test sample we avoid high-dimensional computation. Fur-

thermore, as we will see in the following section the scores

are estimates of multivariate p-values. These turn out to be

sufficient statistics for optimal outlier detection.

III. THEORY: CONSISTENCY OF LPE

A statistical framework for the outlier detection problem is

presented in this section. We establish that outlier detection

is equivalent to thresholding p-values for multivariate data.

We will then show that the score functions developed in the

previous section is an asymptotically consistent estimator of

the p-values. Consequently, it will follow that the strategy of

declaring an outlier when a test sample has a low score is

asymptotically optimal.

Assume that the data belongs to the d-dimensional unit

cube [0, 1]d and the nominal data is sampled from a mul-

tivariate density f0(x) supported on the d-dimensional unit

cube [0, 1]d. Outlier detection can be formulated as a com-

posite hypothesis testing problem. Suppose test data, η comes

from a mixture distribution, namely, f(η) = (1− π)f0(η) +πf1(η) where f1(η) is a mixing density supported on [0, 1]d.

Outlier detection involves testing the nominal hypotheses

H0 : π = 0 versus the alternative (outlier) H1 : π > 0.

The goal is to maximize the detection power subject to false

alarm level α, namely, P(declare H1 | H0) ≤ α.

Definition 1: Let P0 be the nominal probability measure

and f1(·) be P0 measurable. Suppose the likelihood ratio

f1(x)/f0(x) does not have non-zero flat spots on any open

ball in [0, 1]d. Define the p-value of a data point η as

p(η) = P0

(

x :f1(x)

f0(x)≥ f1(η)

f0(η)

)

Note that the definition naturally accounts for singularities

which may arise if the support of f0(·) is a lower dimensional

manifold. In this case we encounter f1(η) > 0, f0(η) = 0and the p-value p(η) = 0. Here outlier is always declared(low

score).

The above formula can be thought of as a mapping of

η → [0, 1]. Furthermore, the distribution of p(η) under H0 is

uniform on [0, 1]. However, as noted in the introduction there

are other such transformations. To build intuition about the

above transformation and its utility consider the following

example. When the mixing density is uniform, namely,

1484

f1(η) = U(η) where U(η) is uniform over [0, 1]d, note

that Ωα = η | p(η) ≥ α is a density level set at level

α. It is well known (see [13]) that such a density level

set is equivalent to a minimum volume set of level α. The

minimum volume set at level α is known to be the uniformly

most powerful decision region for testing H0 : π = 0 versus

the alternative H1 : π > 0 (see [3], [13]). The generalization

to arbitrary f1 is described next.

Theorem 1: The uniformly most powerful test for testing

H0 : π = 0 versus the alternative (outlier) H1 : π > 0 at a

prescribed level α of significance P(declare H1 | H0) ≤ αis:

φ(η) =

H1, p(η) ≤ αH0, otherwise

Proof: See appendix.

Next we derive the relationship between the p-values and

our score function. By definition, RS(η) and RS(xi) are

correlated because the neighborhood of η and xi might

overlap. We modify our algorithm to simplify our analysis.

We assume n is odd (say) and can be written as n = 2m+1.

We divide training set S into two parts:

S = S1 ∩ S2 = x0, x1, · · · , xm ∩ xm+1, · · · , x2m

We modify ǫ-LPE to pǫ(η) =1m

xi∈S1INS2

(η)≥NS1(xi) (or K-LPE to pK(η) =

1m

xi∈S1IRS2

(η)≤RS1(xi)). Now RS2

(η) and RS1(xi)

are independent.

Furthermore, we assume f0(·) satisfies the following two

smoothness conditions:

1) the Hessian matrix H(x) of f0(x) is always domi-

nated by a matrix with largest eigenvalue λM , i.e.,

∃M s.t. H(x) ¹ M ∀x and λmax(M) ≤ λM

2) In the support of f0(·), its value is always lower

bounded by some β > 0.

We have the following theorem.

Theorem 2: Consider the setup above with the training

data xini=1 generated i.i.d. from f0(x). Let η ∈ [0, 1]d be

an arbitrary test sample. It follows that for K = cm2/5 (c is

a constant) and under the above smoothness conditions,

|pK(η) − p(η)| n→∞−→ 0 almost surely, ∀η ∈ [0, 1]d

The proof of Theorem 2 can be found in [17].

Remark: Theorem 2 is stated with specific choices of K.

However, K can be chosen in a range of values, but will

lead to slightly different convergence rate. We will show in

Section IV through simulations that our LPE algorithm is

generally robust to choice of parameter K.

In the rest of this section, we want to elaborate on two

important features of our algorithm. First, we want to talk

about different distance metrics that can be used in our

algorithm and why they are useful. Next, we want to show

through a example that the convergence of our algorithm

only depends on the intrinsic dimension of the support of

distribution f0. Hence our algorithm does not suffer from

the notorious curse of dimensionality.

A. Distance metric

The simplest distance metric d(·, ·) that can be used in our

LPE algorithm is the Euclidean distance. Euclidean distance

does not exploit the intrinsic dimensionality of the support

of f0. When the support of f0 lies on a lower dimensional

manifold (say d′ < d) adopting the geodesic metric leads to

faster convergence and more accurate prediction.

Computing the geodesic distance between two points

in a high dimensional space is a well-known algorithm.

It is used as a subroutine of the Isomap algorithm [14]

and it is essentially an application of the Floyd-Warshall

algorithm [18] which finds the shortest paths between all

pair of points. The output of Geodesic-Learning is proved

to converge the geodesics between any two points among

x1, · · · , xn(see [14], [15]). Note that the K ′ in the geodesic-

learning algorithm is irrelevant with the parameter K in our

LPE algorithm.

GEODESIC-LEARNING(x1, · · · , xn, xn+1 = η)1 for i ← 1 to n + 12 do for j ← 1 to n + 13 do if xj ∈ Euclidean K ′-nearest neighbor of xi

4 then dij ← ‖xi − xj‖5 else dij ← ∞6 for i ← 1 to n + 17 do for j ← 1 to n + 18 do for k ← 1 to n + 19 do dij ← mindij , dik + dkj

10 return dij

We can even consider more sophisticated distance metric.

For example, the geodesic distance only considers the dis-

tance between two points on the manifold of f0. Suppose

now we have a outlier η outside of the manifold. Theoreti-

cally, the distance between η and any points on the manifold

should be defined as infinity. Practically, this intuition can

be accomplished by weighting along different direction.

For any test point η, we find its K-nearest neighbors (in

Euclidean sense) xj1 , xj2 , · · · , xjK. The orthogonal projec-

tion of η onto the manifold is found via the following convex

approximation:

min ‖η −K

i=1

wixji‖2 s.t. ∀i, wi ≥ 0,

K∑

i=1

wi = 1

and the projection η0∆=

∑Ki=1 wixji

. Hence the weighted

distance between η and any training point xt can be defined

as

dW (η, xt) =√

λ‖η − η0‖22 + dG(η0, xt)2

where λ > 1 is a tuning parameter reflecting the weight

we assigned to the normal direction η − η0 of the manifold

and dG(·, ·) denotes the geodesic distance on the manifold.

When η lies on the manifold of the support of f0, η = η0 and

the above defined weighted distance boils down to geodesic

distance.

This weighted distance is useful in the subtle cases where

the outlier η is outside of the manifold but still stays close

1485

−0.5 −0.4 −0.3 −0.2 −0.1 0 0.1 0.2 0.3 0.4 0.5−0.5

−0.4

−0.3

−0.2

−0.1

0

0.1

0.2

0.3

0.4

0.5

Test points

Training points

(a) configuration of training & test points

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

False alarm

Mis

s D

ete

ctio

n

ROC

Euclidean Distance

Weighted distance

(b) Euclidean vs. Weighted

Fig. 2. Usefulness of weighted distance metric; (a) Configurationof the data set: two parallel lines that are close; (b) Empirical ROCcurves for the Euclidean distance and the weighted distance dW (·, ·).

to it. Figure 2 shows an 2D example where the support of

f0 (nominal distribution) is a 1D segment and the outliers

are lying in another 1D segment that is parallel and close

to the nominal data. In this case if we use Euclidean (since

the manifold is linear, the geodesic distance is equivalent to

Euclidean distance) distance metric in our LPE algorithm, we

will get very poor error rate. The solid blue curve in Figure

2 (b) shows the ROC (the ROC is derived by varying α from

0 to 1) in this case, which is bad. On the other hand, if we

use the weighted distance (we set λ = 5 in this example)

as the inputs to LPE, we get a much better ROC (the red

dashed curve).

B. Convergence rate

In the proof of Theorem 2, it is shown that the convergence

rate of our score function pK(η) to the p-value only depends

on the intrinsic dimension d′ of the support of the f0. For

example, if the support of f0 is just a 2D subspace embedded

in a much higher dimensional space Rd, the convergence rate

would only be a function of 2.

To verify this intuition, we carry out the following exper-

iment. In this experiment, we use the benchmark Banana

data set (See Figure 4). Banana dataset contains points with

labels(+1 or −1). We randomly pick 109 points with +1label and regard them as the nominal training data. The test

data comprises of 108 +1 data and 183 −1 data (ground

truth) and the algorithm is supposed to predict +1 data as

“nominal” and −1 data as “outlier”. W want to control false

alarm at level α = 0.05 and therefore the point with score

< α is predicted as outlier. Empirical false alarm can be

computed from ground truth.

Banana is originally a 2D dataset. In order to show the

fact that the convergence rate of LPE only depends on the

intrinsic dimension, we embed each point in Banana data

set to a 50 dimensional space by multiplying a random 50×2matrix to it:

x′ = Gx ∈ R50

where x is a point in Banana data set and G ∈ R50×2 is

a random Gaussian matrix. When n (the size of the training

set) grows, the empirical false alarm is supposed to converge

to the desired false alarm rate α = 0.05. We repeat 100times for a fixed n and record the empirical false alarm

rate for each time. Then the sample mean and variance of

the empirical FA rate can be computed and the result is

shown in Figure 3. We redo all the experiments for the high

dimensional dataset x′ = Gx. We can see that empirical

convergence rates for the low dimensional case and the lifted

high dimensional case are almost indistinguishable. This

verifies our intuition that the convergence rate of our LPE

algorithm is only depending on the intrinsic dimensionality

of the data set.

IV. EXPERIMENTS

We apply our method on both artificial and real-world

data. Our method enables plotting the entire ROC curve by

varying the thresholds on our scores.

To test the sensitivity of K-LPE to parameter changes, we

first run K-LPE on the benchmark artificial data-set Banana

[19] with K varying from 2 to 12 (The geometric layout of

the banana data set is shown in Figure 4.). The size of

the training data is 400 and consists of positive examples.

Euclidean distance metric is adopted for this example. We

let significance level α vary from 0 to 1 and draw the

empirical ROC curve (Figure 5(a)). For comparison we plot

the empirical ROC curve of the one-class SVM of [10]. We

chose an RBF kernel and optimized the bandwidth. In this

case it turns out to be 1.5. We varied ν from 0 to 1 to get the

ROC curve. In Figure 5(a), we can see that our algorithm

is consistently better than one-class SVM on the Banana

dataset. Furthermore, we found that choosing suitable tuning

parameters to control false alarms is generally difficult in the

one-class SVM approach.

In Figure 5(b), we ran K-LPE on another 2D example

where the nominal distribution f0 is a mixture Gaussian and

1486

0 500 1000 1500 20000.04

0.05

0.06

0.07

0.08

0.09

0.1

Number of training points

Me

an

of

Fa

lse

Ala

rm w

ith

α =

0.0

5

dim=2

dim=50

(a) The mean of the empirical FA

0 500 1000 1500 20000

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1x 10

−3

Number of training points

Va

ria

nce

of

Fa

lse

Ala

rm w

ith

α =

0.0

5

dim=2

dim=50

(b)The variance of the empirical FA

Fig. 3. Usefulness of weighted distance metric; (a) Configurationof the data set: two parallel lines that are close; (b) Empirical ROCcurves for the Euclidean distance and the weighted distance dW (·, ·).

−3 −2 −1 0 1 2 3−2

−1.5

−1

−0.5

0

0.5

1

1.5

2

2.5

positive data

unlabeled data

Fig. 4. The layout of training set (all nominal data) and unlabeledtest points (nominal and anomaly) of the banana data set.

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

false positives

tru

e p

ositiv

es

banana data set

ROC of LPE (K=2)

ROC of LPE (K=4)

ROC of LPE (K=6)

ROC of LPE (K=8)

ROC of LPE (K=10)

ROC of LPE (K=12)

ROC of one−class SVM

(a) SVM vs. K-LPE for Banana Data

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

false positives

tru

e p

ositiv

es

2D Gaussian mixture

ROC of LPE(n=40)

ROC of LPE(n=160)

Clairvoyant ROC

(b) Clairvoyant vs. K-LPE

Fig. 5. Performance Robustness of LPE; (a) Empirical ROC curveof K-LPE on the banana dataset [19] with K = 2, 4, 6, 8, 10, 12(with n = 400) vs the empirical ROC curve of one class SVMdeveloped in [10]; (b) Averaged (over 15 trials) empirical ROCcurves of K-LPE algorithm vs clairvoyant ROC curve when f0 isgiven by Equation 3) for K = 6 and for different values of n(n = 40, 160).

the anomalous distribution is very close to uniform:

f0 ∼ 1

2N

([

80

]

,

[

1 00 9

])

+1

2N

([

−80

]

,

[

1 00 9

])

(3)

f1 ∼ N(

0,

[

49 00 49

])

(4)

In this example, we can exactly compute the optimal ROC

curve. We call this curve the Clairvoyant ROC ( the red

dashed curve in Figure 5(b)). The other two curves are

averaged (over 15 trials) empirical ROC curves with respect

to different sizes of training sample (n = 40, 160) for K = 6.

Larger n results in better ROC curve. We see that for a

relatively small training set of size 160 the average empirical

ROC curve is very close to the clairvoyant ROC curve.

Next, we ran LPE on three real-world datasets: Wine,

Ionosphere [20] and MNIST US Postal Service (USPS)

1487

database of handwritten digits. In the experiment, we always

treat points with one particular label as nominal and regard

the points with other labels as anomalous. For example, for

the USPS dataset, we regard instances of digit 0 as nominal

training samples and digits 1, · · · , 9 as anomaly.

In this example, the data points are normalized within

[0, 1]d and we use geodesic distance [14] as the input to

LPE. The ROC curves of these four datasets are shown in

Figure 6. In Wine dataset, the dimension of the feature space

is 13. The training set is composed of 39 data points and we

apply the ǫ-LPE algorithm with ǫ = 0.9. In Ionosphere

dataset, the dimension of the feature space is 34. The training

set is composed of 175 data points and we apply the K-LPE

algorithm with K = 9. In USPS dataset, the dimension of the

feature space is 16×16 = 256. The training set is composed

of 400 data points and we apply the K-LPE algorithm with

K = 9. Also for comparison purposes we note from Figure

6(c) that when the false-positive rate is 5%, the false-negative

rate is 5% (In contrast FP = 7% and FN = 9% for one-

class SVM [10]). Practically we find that K-LPE is more

preferable to ǫ-LPE due to ease of choosing K. We find that

the value of K is relatively independent of dimension d. As

a rule of thumb we found that choosing K smaller than√

nwas generally effective.

V. CONCLUSION

In this paper, we proposed a novel non-parametric adaptive

outlier detection algorithm which leads to a computationally

efficient solution with provable optimality guarantees. Our

algorithm takes a K-nearest neighbor graph as an input and

produces a score for each test point. Scores turn out to

be empirical estimates of the volume of minimum volume

level sets containing the test point. While minimum volume

level sets provide an optimal characterization for outlier

detection, they are high dimensional quantities and generally

difficult to reliably compute in high dimensional feature

spaces. Nevertheless, a sufficient statistic for optimal tradeoff

between false alarms and misses is the volume of the MV

set itself, which is a real number. By computing score

functions we avoid computing high dimensional quantities

and still ensure optimal control of false alarms and misses.

The computational cost of our algorithm scales linearly in

dimension and quadratically in data size.

APPENDIX: PROOF TO THEOREM 1

The proof and the statement of the theorem also appear

in [21]. We include it here for completeness’s sake.

Recall that the p-value of a data point η is

p(η) = P0

(

x :f1(x)

f0(x)≥ f1(η)

f0(η)

)

We begin by establishing that p(η) ∼ U [0, 1], which

implies that we can control false alarm at desired levels if

we use the p(η) as test statistics. For simplicity of notation,

we denote φ(x) = f1(x)/f0(x).Lemma 1: If the likelihood ratio φ is nowhere constant,

then Y = p(η) is uniformly distributed in [0, 1]; i.e., Y ∼U [0, 1].

Proof: Note that for any sequence φ1 > φ2 > . . . the

sets Ai = x : φ(x) > φi form a nested sequence of sets

such that A1 ⊂ A2 ⊂ . . . . Then,

PrY ≤ y= PrP0x : φ(x) > φ(X) ≤ P0x : φ(x) > φ(η)= PrP0x : φ(x) > φ(X) < P0x : φ(x) > φ(η)= Prx : φ(x) > φ(X) ⊂ x : φ(x) > φ(η)= Prφ(X) > φ(η) = P0x : φ(x) > φ(η) = y

where the probability measure is P0, the second inequality

follows from the continuity of Y , and the third equality

follows from the fact that the sets are nested.

Next, the following lemma will be necessary to formalize

the fact that our proposed p-value leads to maximal detection.

Lemma 2: Let Z = s(η) be any test statistic obtained

from the observations η such that Z ∼ U [0, 1] under the null

hypothesis. If Y = p(η), then PrY ≤ α ≥ PrZ ≤ α,

where the probability measure is f× = πf1 + (1 − π)f0 for

some mixture parameter π.

Proof: We can write for Y and Z:

PrY ≤ α = π PrY ≤ α | H = H1+(1 − π) PrY ≤ α | H = H0

= π PrY ≤ α | H = H1 + (1 − π)α

PrZ ≤ α = π PrZ ≤ α | H = H1+(1 − π) PrZ ≤ α | H = H0

= π PrZ ≤ α | H = H1 + (1 − π)α

Then, to prove our result, it suffices to show that PrY ≤α | H = H1 ≥ PrZ ≤ α | H = H1. To show this,

let, for some appropriate φ1, Ap = X : φ(X) > φ1be the set such that P0(A

p) = α. Notice that for Z, the

uniform distribution under the null hypothesis assumption

implies PrZ : Z ≤ α | H = H0 = P0X : s(X) ≤ α |H = H0 = α. Write As = X : s(X) ≤ α | H = H0.

Then, P1(Ap) = P1(A

p−As)+P1(Ap∩As), and similarly

P1(As) = P1(A

s−Ap)+P1(Ap∩As), where A−B denotes

the removal of set B from set A.

Observe that showing PrY ≤ α | H = H1 ≥ PrZ ≤α | H = H1 is equivalent to showing P1(A

p)−P1(As) =

P1(Ap − As) − P1(A

s − Ap) ≥ 0. To show this, observe

that P0(Ap − As) = P0(A

s − Ap) = α′ for some α′ =α −P0(A

p ∩ As). But, over Ap − As, dP1/dP0 = φ > φ1,

and hence P1(Ap − As) > φ1α

′. Similarly, over As − Ap,

f1/f0 = φ ≤ φ1, and hence P1(As − Ap) ≤ φ1α

′, which

implies P1(Ap) − P1(A

s) ≥ 0 and concludes the proof.

We next establish that F1, the CDF of f1, is concave; i.e.

the density function f1 is monotone decreasing in [0, 1].

Lemma 3: If the φ = f1/f0 is nowhere constant, then F1

is concave.

Proof: Again noting that for any sequence φ1 > φ2 >. . . the sets Ai = x : φ(x) > φi form a nested sequence

of sets such that A1 ⊂ A2 ⊂ . . . (used in transitioning from

1488

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

false positive

true p

ositiv

e

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

false positive

true p

ositiv

e

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

false positive

true p

ositiv

e

(a) Wine (b) Ionosphere (c) USPS

Fig. 6. ROC curves on real datasets via LPE; (a) Wine dataset with D = 13, n = 39, ǫ = 0.9; (b) Ionosphere dataset withD = 34, n = 175, K = 9; (c) USPS dataset with D = 256, n = 400, K = 9.

the third equality to the fourth equality below), we can write:

F1(y) = PrY ≤ y= PrP0x : φ(x) > φ(X) ≤ P0x : φ(x) > φ(η)= PrP0x : φ(x) > φ(X) < P0x : φ(x) > φ(η)= Prx : φ(x) > φ(X) ⊂ x : φ(x) > φ(η)= Prφ(X) > φ(η) = P1x : φ(x) > φ(η)

Observe that here the probability measure is P1.

Now, let φ1 > φ2 > φ3 be such that for Ai = x : φ(x) >φi, i = 1, 2, 3, P0(A1) = y1, P0(A2) = y2 = y1 + δ0, and

P0(A3) = y3 = y2+δ0 for some appropriate y1 and δ0. Also,

F1(y1) = P1(A1) = z1, F1(y

2) = P1(A2) = z2 = z1 + δ1,

and F1(y3) = P1(A3) = z3 = z2 + δ2 for some appropriate

z1, δ1 and δ2.

Notice that δ1 = P1(A2 − A1) and δ2 = P1(A3 − A2).Noting that P0(A2 − A1) = P0(A3 − A2) = δ0 and noting

that Ai are constructed using the Radon-Nikodym derivative,

it follows that δ1 ≥ δ2. Thus we can write

F1(y2) − F1(y

1)

y2 − y1=

δ1

δ0≥ δ2

δ0=

F1(y3) − F1(y

2)

y3 − y2

But this holds true for all φ1 > φ2 > φ3 such that δ0 > 0,

and hence the result follows.

Theorem 1 follows immediately from Lemmas 2 and 3.

Recall that F0 is a uniform distribution in [0, 1], any set (in

[0, 1]) of Lebesgue measure α has probability of false alarm

exactly α. Since, according to Lemma 3, F1 is concave,

its density is monotone decreasing. Therefore among the

sets of length α, R = [0, α] carries the most mass under

F1. Furthermore, as a consequence of Lemma 2, among all

transformations that generate a uniform F0, p(η) maximizes

F1(α) and the corollary follows.

REFERENCES

[1] C. Campbell and K. P. Bennett, “A linear programming approachto novelty detection,” in Advances in Neural Information Processing

Systems 13. MIT Press, 2001, pp. 395–401.[2] M. Markou and S. Singh, “Novelty detection: a review – part 1:

statistical approaches,” Signal Processing, vol. 83, pp. 2481–2497,2003.

[3] A. O. Hero, “Geometric entropy minimization(GEM) for anomalydetection and localization,” in Neural Information Processing Systems

Conference, vol. 19, 2006.[4] R. Vert and J. Vert, “Consistency and convergence rates of one-class

svms and related algorithms,” Journal of Machine Learning Research,vol. 7, pp. 817–854, 2006.

[5] D. Tax and K. R. Muller, “Feature extraction for one-class classifica-tion,” in Artificial neural networks and neural information processing,Istanbul, TURQUIE, 2003.

[6] R. El-Yaniv and M. Nisenson, “Optimal singl-class classificationstrategies,” in Advances in Neural Information Processing Systems 19.MIT Press, 2007.

[7] I. V. Nikiforov and M. Basseville, Detection of abrupt changes: theory

and applications. Prentice-Hall, New Jersey, 1993.[8] R. Ramaswamy, R. Rastogi, and K. Shim, “Efficient algorithms for

mining outliers from large data sets,” in Proceedings of the ACM

SIGMOD Conference, 2000.[9] K. Zhang, M. Hutter, and H. Jin, “A new local distance-based

outlier detection approach for scattered real-world data,” March 2009,arXiv:0903.3257v1[cs.LG].

[10] B. Scholkopf, J. C. Platt, J. Shawe-Taylor, A. J. Smola, andR. Williamson, “Estimating the support of a high-dimensional dis-tribution,” Neural Computation, vol. 13, no. 7, pp. 1443–1471, 2001.

[11] D. Tax, “One-class classification: Concept-learning in the absence ofcounter-examples,” Ph.D. dissertation, Delft University of Technology,June 2001.

[12] G. R. G. Lanckriet, L. E. Ghaoui, and M. I. Jordan, “Robust noveltydetection with single-class MPM,” in Neural Information Processing

Systems Conference, vol. 18, 2005.[13] C. Scott and R. D. Nowak, “Learning minimum volume sets,” Journal

of Machine Learning Research, vol. 7, pp. 665–704, 2006.[14] J. B. Tenenbaum, V. de Silva, and J. C. Langford, “A global geometric

framework fo nonlinear dimensionality reduction,” Science, vol. 290,pp. 2319–2323, 2000.

[15] M. Bernstein, V. D. Silva, J. C. Langford, and J. B. Tenenbaum,“Graph approximations to geodesics on embedded manifolds,” 2000.

[16] S. T. Roweis and L. K. Saul, “Nonlinear dimensionality reduction bylocal linear embedding,” Science, vol. 290, pp. 2323–2326, 2000.

[17] M. Zhao and V. Saligrama, “Anomaly detection with score functionsbased on nearest neighbor graphs,” in Neural Information Processing

Systems Conference, vol. 22, 2009.[18] C. H. Papadimitriou and K. Steiglitz, Combinaorial Optimization:

Algorithms and Complexity. Dover Publications, Inc., 1998.[19] “Benchmark repository.” [Online]. Available:

http://ida.first.fhg.de/projects/bench/benchmarks.htm[20] A. Asuncion and D. J. Newman, “UCI ma-

chine learning repository,” 2007. [Online]. Available:http://www.ics.uci.edu/∼mlearn/MLRepository.html

[21] E. B. Ermis and V. Saligrama, “Distributed detection in sensornetworks with limited range multi-modal sensors,” September 2008,arXiv:0809.1900v1 [cs.IT].

1489