Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 CSE 881: Data Mining Lecture 22: Anomaly Detection.

Similar presentations


Presentation on theme: "1 CSE 881: Data Mining Lecture 22: Anomaly Detection."— Presentation transcript:

1 1 CSE 881: Data Mining Lecture 22: Anomaly Detection

2 2 Anomaly/Outlier Detection l What are anomalies/outliers? –Data points whose characteristics are considerably different than the remainder of the data l Applications: –Credit card fraud detection –telecommunication fraud detection –network intrusion detection –fault detection

3 3 Examples of Anomalies l Data from different classes –An object may be different from other objects because it is of a different type or class l Natural (random) variation in data –Many data sets can be modeled by statistical distributions (e.g., Gaussian distribution) –Probability of an object decreases rapidly as its distance from the center of the distribution increases –Chebyshev inequality: l Data measurement or collection errors

4 4 Importance of Anomaly Detection Ozone Depletion History l In 1985 three researchers (Farman, Gardinar and Shanklin) were puzzled by data gathered by the British Antarctic Survey showing that ozone levels for Antarctica had dropped 10% below normal levels l Why did the Nimbus 7 satellite, which had instruments aboard for recording ozone levels, not record similarly low ozone concentrations? l The ozone concentrations recorded by the satellite were so low they were being treated as outliers by a computer program and discarded! Sources: http://exploringdata.cqu.edu.au/ozone.html http://www.epa.gov/ozone/science/hole/size.html

5 5 Anomalies l General characteristics –Rare occurrence –Deviant behavior compared to the majority of the data l Distribution –Natural variation  uniform distribution –Data from different classes  distribution may be clustered

6 6 Anomaly Detection l Challenges –Method is (mostly) unsupervised  Validation can be quite challenging (just like for clustering) –Small number of anomalies  Finding needle in a haystack

7 7 Anomaly Detection Schemes l General Steps –Build a profile of the “normal” behavior  Profile can be patterns or summary statistics for the normal population –Use the “normal” profile to detect anomalies  Anomalies are observations whose characteristics differ significantly from the normal profile l Types of anomaly detection schemes –Graphical & Statistical-based –Distance-based

8 8 Graphical Approaches l Boxplot (1-D), Scatter plot (2-D), Spin plot (3-D) l Limitations –Time consuming –Subjective

9 9 Convex Hull Method l Extreme points are assumed to be outliers l Use convex hull method to detect extreme values l What if the outlier occurs in the middle of the data?

10 10 Statistical Approaches l Assume a parametric model describing the distribution of the data (e.g., normal distribution) l Apply a statistical test that depends on –Data distribution –Parameter of distribution (e.g., mean, variance) –Number of expected outliers (confidence limit)

11 11 Grubbs’ Test l Detect outliers in univariate data l Assume data comes from normal distribution l Detects one outlier at a time, remove the outlier, and repeat –H 0 : There is no outlier in data –H A : There is at least one outlier l Grubbs’ test statistic: l Reject H 0 if:

12 12 Statistical-based – Likelihood Approach l Assume the data set D consists of samples from a mixture of two probability distributions: –M (majority distribution) –A (anomalous distribution) l General Approach: –Initially, assume all the data points belong to M –Let L t (D) be the log likelihood of D –Choose a point x t that belongs to M and move it to A  Let L t+1 (D) be the new log likelihood.  Compute the difference,  = L t (D) – L t+1 (D)  If  > c (some threshold), then x t is declared an anomaly and is moved permanently from M to A

13 13 Statistical-based – Likelihood Approach l Data distribution, D = (1 – ) M + A –M is a probability distribution estimated from data  Can be based on any modeling method (naïve Bayes, maximum entropy, etc) –A is often assumed to be uniform distribution l Likelihood at time t:

14 14 Limitations of Statistical Approaches l Most of the tests are for a single attribute l In many cases, the data distribution may not be known l For high dimensional data, it may be difficult to estimate the true distribution

15 15 Distance-based Approaches l Data is represented as a vector of features l Three approaches –Nearest-neighbor based –Density based –Clustering based

16 16 Nearest-Neighbor Based Approach l Approach: –Compute the distance between every pair of data points –There are various ways to define outliers:  Data points with fewer than p points within a neighborhood of radius D  Data points whose distance to the kth nearest neighbor is among the highest  Data points whose average distance to the k nearest neighbors is among the highest

17 17 Outliers in Lower Dimensional Projection l In high-dimensional space, data is sparse and notion of proximity becomes meaningless –Every point is an almost equally good outlier from the perspective of proximity-based definitions l Lower-dimensional projection methods –A point is an outlier if in some lower dimensional projection, it is present in a local region of abnormally low density

18 18 Outliers in Lower Dimensional Projection l Divide each attribute into  equal-depth intervals –Each interval contains a fraction f = 1/  of the records l Consider a k-dimensional cube created by picking grid ranges from k different dimensions –If attributes are independent, we expect region to contain a fraction f k of the records –If there are N points, we can measure sparsity of a cube D as: –Negative sparsity indicates cube contains smaller number of points than expected

19 19 Example l N=100,  = 5, f = 1/5 = 0.2, N  f 2 = 4

20 20 Density-based: LOF approach l For each point, compute the density of its local neighborhood l Compute local outlier factor (LOF) of a sample p as the average of the ratios of the density of sample p and the density of its nearest neighbors l Outliers are points with largest LOF value p 2  p 1  In the NN approach, p 2 is not considered as outlier, while LOF approach find both p 1 and p 2 as outliers

21 21 Clustering-Based l Basic idea: –Cluster the data into groups of different density –Choose points in small cluster as candidate outliers –Compute the distance between candidate points and non-candidate clusters.  If candidate points are far from all other non-candidate points, they are outliers

22 22 One-Class SVM l Based on support vector clustering –Extension of SVM approach to clustering –2 key ideas in SVM:  It uses the maximal margin principle to find the linear separating hyperplane  For nonlinearly separable data, it uses a kernel function to project the data into higher dimensional space

23 23 Support Vector Machine (Idea 1) l Maximal margin principle subject to the following constraints: Objective function to minimize:

24 24 Support Vector Machine (Idea 2) Original SpaceHigh-dimensional Feature Space

25 25 Support Vector Clustering Original Space High-dimensional Feature Space ? What is the corresponding maximum margin principle?

26 26 Support Vector Clustering l In SVM –Start with the simplest case first, then make the problem more complex –Simplest case: linearly separable data l Apply same idea to clustering –What is the simplest case?  All the points belong to a single cluster  The cluster is globular (spherical)

27 27 SVC Support Vector Clustering SVM Choose the hyperplane with largest margin Choose the sphere with smallest radius

28 28 Support Vector Clustering l Let R be the radius of the sphere l Goal is to: subject to: where: –a is the center of the sphere a x

29 29 Support Vector Clustering l Objective function: –where  I ’s are the Lagrange multipliers –Subject to:   i  0 

30 30 Support Vector Clustering l Objective function (dual form): l Find the  I ’s that maximizes the expression s.t.

31 31 Support Vector Clustering l Since –If x i is located in the interior of the sphere, then  i = 0 –If x i is located on the surface of the sphere then  i  0 l Support vectors are the data points located on the cluster boundary

32 32 Outliers l Outliers are considered data points located outside the sphere l Let  i be the error for x i l Goal is to: –subject to: a x  

33 33 Outliers l Lagrangian: –Subject to:

34 34 Outliers l Dual form: –Same as the previous (no outlier) case

35 35 Outliers l Since –If x i is located in the interior of the sphere, then  i = 0 –If x i is located on the surface of the sphere then  i  0  Such points are called the support vectors –If x i is located outside of the sphere then  i = 0  Such points are called the bounded support vectors

36 36 Irregular Shaped Clusters l What if the cluster have irregular shaped in the original space? –Instead of using a very large sphere, or a sphere with large errors (   i ), project the data into higher- dimensional space (kernel trick) xixi (xi)(xi) 

37 37 Irregular Shaped Clusters l Objective function (dual form): l Kernel trick: –Use kernel function in place of  (x i )   (x j ) –Typical kernel function:  Gaussian:

38 38 References l Support Vector Clustering By Ben-Hur, Horn, Siegelmann, and Vapnik (Journal of Machine Learning Research, 2001) http://citeseer.ist.psu.edu/hur01support.html l Cone Cluster Labeling for Support Vector Clustering By Lee and Daniels (in Proc. of SIAM Int’l Conf on Data Mining, 2006) http://www.siam.org/meetings/sdm06/proceedings/046lees.pdf

39 39 Graph-based Method l Represent the data as a graph –Objects  nodes –Similarity  edges l Apply graph-based method to determine outliers Objects Object Graph

40 40 Graph-based Method Find the most outlying node in the graph => Opposite of finding the most “central” node

41 41 Graph-based Method l Many measures of node centrality –Degree –Closeness:  where d(u,n) is the geodesic distance between u and n –Geodesic distance is the shortest path distance –Betweenness:  where g jk (n ) is the number of geodesic paths from j to k that pass through n –Random walk method

42 42 Random Walk Method l Random walk model –Randomly pick a starting node, s –Randomly choose a neighboring node linked to s. Set current node s to be the neighboring node. –Repeat step 2 l Compute the probability that you will reach a particular node in the graph –The higher the probability, the more “central” the node is.

43 43 Random Walk Method l Goal: Find the stationary distribution c – Vector c represents probability value for each object –Initially, set c(i) = 1/N (for all i=1,…,N) l Let S be the adjacency matrix of the graph –Normalized the rows so that S(i,j) becomes a transition probability l Iteratively compute: –Until c converges to a stationary distribution –To ensure convergence, use a damping factor, d:

44 44 Random Walk Method l Applications –Web search (PageRank algorithm used by Google) –Text summarization –Keyword extraction

45 45 Random Walk for Anomaly Detection l Assess the centrality or importance of individual objects For closely related data (e.g., documents returned by PageRank) For data containing anomalies Highly relevant web pages Anomalies

46 46 Example l Sample dataset ObjectConnectivityRank 1 2 3 4 5 6 7 8 9 10 11 0.0835 0.0764 0.0930 0.0922 0.0914 0.0940 0.0936 0.0930 0.0942 0.0939 2 1 5 4 3 9 7 6 10 11 8 l Model parameter tuning –damping factor=0.1 –Converge after 112 steps


Download ppt "1 CSE 881: Data Mining Lecture 22: Anomaly Detection."

Similar presentations


Ads by Google