+ All Categories
Home > Documents > Data Miningce.sharif.edu/courses/95-96/1/ce714-1/resources/root/...data analysis, including outlier...

Data Miningce.sharif.edu/courses/95-96/1/ce714-1/resources/root/...data analysis, including outlier...

Date post: 26-Jul-2020
Category:
Upload: others
View: 9 times
Download: 1 times
Share this document with a friend
22
Data Mining Outlier detection Hamid Beigy Sharif University of Technology Fall 1395 Hamid Beigy (Sharif University of Technology) Data Mining Fall 1395 1 / 17
Transcript
Page 1: Data Miningce.sharif.edu/courses/95-96/1/ce714-1/resources/root/...data analysis, including outlier detection. For example, in credit card fraud detection, For example, in credit card

Data MiningOutlier detection

Hamid Beigy

Sharif University of Technology

Fall 1395

Hamid Beigy (Sharif University of Technology) Data Mining Fall 1395 1 / 17

Page 2: Data Miningce.sharif.edu/courses/95-96/1/ce714-1/resources/root/...data analysis, including outlier detection. For example, in credit card fraud detection, For example, in credit card

Table of contents

1 Introduction

2 Outlier detection methodsStatistical methodsProximity-based methodsClustering-based methodsClassification-based methods

3 Mining contextual outliers

4 Mining collective outliers

5 Reading

Hamid Beigy (Sharif University of Technology) Data Mining Fall 1395 2 / 17

Page 3: Data Miningce.sharif.edu/courses/95-96/1/ce714-1/resources/root/...data analysis, including outlier detection. For example, in credit card fraud detection, For example, in credit card

Table of contents

1 Introduction

2 Outlier detection methodsStatistical methodsProximity-based methodsClustering-based methodsClassification-based methods

3 Mining contextual outliers

4 Mining collective outliers

5 Reading

Hamid Beigy (Sharif University of Technology) Data Mining Fall 1395 3 / 17

Page 4: Data Miningce.sharif.edu/courses/95-96/1/ce714-1/resources/root/...data analysis, including outlier detection. For example, in credit card fraud detection, For example, in credit card

Introduction

Outlier detection is the process of finding data objects with behaviorsthat are very different from expectation.

Such objects are called outliers or anomalies.

An outlier is a data object that deviates significantly from the rest ofthe objects, as if it were generated by a different mechanism.

Outlier detection and clustering analysis are two highly related tasks.

Clustering finds the majority patterns in a data set and organizes thedata accordingly, whereas outlier detection tries to capture thoseexceptional cases that deviate substantially from the majoritypatterns.

Hamid Beigy (Sharif University of Technology) Data Mining Fall 1395 3 / 17

Page 5: Data Miningce.sharif.edu/courses/95-96/1/ce714-1/resources/root/...data analysis, including outlier detection. For example, in credit card fraud detection, For example, in credit card

Introduction

Outlier detection is the process of finding data objects with behaviorsthat are very different from expectation.

Outliers are different from noisy data. Noise is a random error orvariance in a measured variable.

Outliers are interesting because they are suspected of not beinggenerated by the same mechanisms as the rest of the data.

HAN 19-ch12-543-584-9780123814791 2011/6/1 3:25 Page 544 #2

544 Chapter 12 Outlier Detection

12.1 Outliers and Outlier Analysis

Let us first define what outliers are, categorize the different types of outliers, and thendiscuss the challenges in outlier detection at a general level.

12.1.1 What Are Outliers?Assume that a given statistical process is used to generate a set of data objects. An outlieris a data object that deviates significantly from the rest of the objects, as if it were gen-erated by a different mechanism. For ease of presentation within this chapter, we mayrefer to data objects that are not outliers as “normal” or expected data. Similarly, we mayrefer to outliers as “abnormal” data.

Example 12.1 Outliers. In Figure 12.1, most objects follow a roughly Gaussian distribution. However,the objects in region R are significantly different. It is unlikely that they follow the samedistribution as the other objects in the data set. Thus, the objects in R are outliers in thedata set.

Outliers are different from noisy data. As mentioned in Chapter 3, noise is a ran-dom error or variance in a measured variable. In general, noise is not interesting indata analysis, including outlier detection. For example, in credit card fraud detection,a customer’s purchase behavior can be modeled as a random variable. A customer maygenerate some “noise transactions” that may seem like “random errors” or “variance,”such as by buying a bigger lunch one day, or having one more cup of coffee than usual.Such transactions should not be treated as outliers; otherwise, the credit card companywould incur heavy costs from verifying that many transactions. The company may alsolose customers by bothering them with multiple false alarms. As in many other dataanalysis and data mining tasks, noise should be removed before outlier detection.

Outliers are interesting because they are suspected of not being generated by the samemechanisms as the rest of the data. Therefore, in outlier detection, it is important to

R

Figure 12.1 The objects in region R are outliers.Hamid Beigy (Sharif University of Technology) Data Mining Fall 1395 4 / 17

Page 6: Data Miningce.sharif.edu/courses/95-96/1/ce714-1/resources/root/...data analysis, including outlier detection. For example, in credit card fraud detection, For example, in credit card

Types of outliers

Outliers can be classified into three categories:Global outliers : A data object is a global outlier if it deviatessignificantly from the rest of the data set. Global outliers aresometimes called point anomalies, and are the simplest type of outliers.

HAN 19-ch12-543-584-9780123814791 2011/6/1 3:25 Page 544 #2

544 Chapter 12 Outlier Detection

12.1 Outliers and Outlier Analysis

Let us first define what outliers are, categorize the different types of outliers, and thendiscuss the challenges in outlier detection at a general level.

12.1.1 What Are Outliers?Assume that a given statistical process is used to generate a set of data objects. An outlieris a data object that deviates significantly from the rest of the objects, as if it were gen-erated by a different mechanism. For ease of presentation within this chapter, we mayrefer to data objects that are not outliers as “normal” or expected data. Similarly, we mayrefer to outliers as “abnormal” data.

Example 12.1 Outliers. In Figure 12.1, most objects follow a roughly Gaussian distribution. However,the objects in region R are significantly different. It is unlikely that they follow the samedistribution as the other objects in the data set. Thus, the objects in R are outliers in thedata set.

Outliers are different from noisy data. As mentioned in Chapter 3, noise is a ran-dom error or variance in a measured variable. In general, noise is not interesting indata analysis, including outlier detection. For example, in credit card fraud detection,a customer’s purchase behavior can be modeled as a random variable. A customer maygenerate some “noise transactions” that may seem like “random errors” or “variance,”such as by buying a bigger lunch one day, or having one more cup of coffee than usual.Such transactions should not be treated as outliers; otherwise, the credit card companywould incur heavy costs from verifying that many transactions. The company may alsolose customers by bothering them with multiple false alarms. As in many other dataanalysis and data mining tasks, noise should be removed before outlier detection.

Outliers are interesting because they are suspected of not being generated by the samemechanisms as the rest of the data. Therefore, in outlier detection, it is important to

R

Figure 12.1 The objects in region R are outliers.Contextual outliers : A data object is a contextual outlier if it deviatessignificantly with respect to a specific context of the object.For example, 0oC is an outlier in the summer while it is not outlier inthe winter.Collective outliers : A subset of data objects forms a collective outlierif the objects as a whole deviate significantly from the entire data set.

HAN 19-ch12-543-584-9780123814791 2011/6/1 3:25 Page 547 #5

12.1 Outliers and Outlier Analysis 547

The quality of contextual outlier detection in an application depends on themeaningfulness of the contextual attributes, in addition to the measurement of the devi-ation of an object to the majority in the space of behavioral attributes. More oftenthan not, the contextual attributes should be determined by domain experts, whichcan be regarded as part of the input background knowledge. In many applications, nei-ther obtaining sufficient information to determine contextual attributes nor collectinghigh-quality contextual attribute data is easy.

“How can we formulate meaningful contexts in contextual outlier detection?” Astraightforward method simply uses group-bys of the contextual attributes as contexts.This may not be effective, however, because many group-bys may have insufficient dataand/or noise. A more general method uses the proximity of data objects in the space ofcontextual attributes. We discuss this approach in detail in Section 12.4.

Collective OutliersSuppose you are a supply-chain manager of AllElectronics. You handle thousands oforders and shipments every day. If the shipment of an order is delayed, it may not beconsidered an outlier because, statistically, delays occur from time to time. However,you have to pay attention if 100 orders are delayed on a single day. Those 100 ordersas a whole form an outlier, although each of them may not be regarded as an outlier ifconsidered individually. You may have to take a close look at those orders collectively tounderstand the shipment problem.

Given a data set, a subset of data objects forms a collective outlier if the objects asa whole deviate significantly from the entire data set. Importantly, the individual dataobjects may not be outliers.

Example 12.4 Collective outliers. In Figure 12.2, the black objects as a whole form a collective outlierbecause the density of those objects is much higher than the rest in the data set. However,every black object individually is not an outlier with respect to the whole data set.

Figure 12.2 The black objects form a collective outlier.Hamid Beigy (Sharif University of Technology) Data Mining Fall 1395 5 / 17

Page 7: Data Miningce.sharif.edu/courses/95-96/1/ce714-1/resources/root/...data analysis, including outlier detection. For example, in credit card fraud detection, For example, in credit card

Challenges of outlier detection

Outlier detection is useful in many applications yet faces manychallenges such as the following

Modeling normal objects and outliers effectively : Outlier detectionquality highly depends on the modeling of normal objects and outliers.Building a comprehensive model for data normality is very challenging,if not impossible.Application-specific outlier detection : Choosing the similarity/distance measure and the relationship model to describe data objects iscritical in outlier detection. Such choices are oftenapplication-dependent.Handling noise in outlier detection : Noise often unavoidably exists indata collected in many applications. Low data quality and the presenceof noise bring a huge challenge to outlier detection.Understandability : A user may want to not only detect outliers, butalso understand why the detected objects are outliers.

Hamid Beigy (Sharif University of Technology) Data Mining Fall 1395 6 / 17

Page 8: Data Miningce.sharif.edu/courses/95-96/1/ce714-1/resources/root/...data analysis, including outlier detection. For example, in credit card fraud detection, For example, in credit card

Table of contents

1 Introduction

2 Outlier detection methodsStatistical methodsProximity-based methodsClustering-based methodsClassification-based methods

3 Mining contextual outliers

4 Mining collective outliers

5 Reading

Hamid Beigy (Sharif University of Technology) Data Mining Fall 1395 7 / 17

Page 9: Data Miningce.sharif.edu/courses/95-96/1/ce714-1/resources/root/...data analysis, including outlier detection. For example, in credit card fraud detection, For example, in credit card

Outlier detection methods

We can categorize outlier detection methods according to whether thesample of data for analysis is given with domain expertprovided labelsthat can be used to build an outlier detection model.

Supervised methods : Domain experts examine and label a sample ofthe underlying data. Outlier detection can then be modeled as aclassification problem.Unsupervised methods : Unsupervised outlier detection methods makean implicit assumption: The normal objects are somewhat clustered. Inother words, an unsupervised outlier detection method expects thatnormal objects follow a pattern far more frequently than outliers.Semi-supervised methods : We may encounter cases where only asmall set of the normal and/or outlier objects are labeled, but most ofthe data are unlabeled.

Hamid Beigy (Sharif University of Technology) Data Mining Fall 1395 7 / 17

Page 10: Data Miningce.sharif.edu/courses/95-96/1/ce714-1/resources/root/...data analysis, including outlier detection. For example, in credit card fraud detection, For example, in credit card

Outlier detection methods (cont.)

We can divide outlier detection methods into groups according totheir assumptions regarding normal objects versus outliers.

Statistical methods (model-based methods) : These methods assumethat normal data objects are generated by a statistical (stochastic)model, and that data not following the model are outliers.Proximity-based methods : These methods assume that an object isan outlier if the nearest neighbors of the object are far away in featurespace, that is, the proximity of the object to its neighbors significantlydeviates from the proximity of most of the other objects to theirneighbors in the same data set.Clustering-based methods : These methods assume that the normaldata objects belong to large and dense clusters, whereas outliers belongto small or sparse clusters, or do not belong to any clusters.

Hamid Beigy (Sharif University of Technology) Data Mining Fall 1395 8 / 17

Page 11: Data Miningce.sharif.edu/courses/95-96/1/ce714-1/resources/root/...data analysis, including outlier detection. For example, in credit card fraud detection, For example, in credit card

Statistical methods

As with statistical methods for clustering, statistical methods foroutlier detection make assumptions about data normality. Theyassume that the normal objects in a data set are generated by astochastic process (a generative model). Consequently, normalobjects occur in regions of high probability for the stochastic model,and objects in the regions of low probability are outliers.

Statistical methods for outlier detection can be divided into two majorcategories:

Parametric methods : A parametric method assumes that the normaldata objects are generated by a parametric distribution with parameterθ.Nonparametric methods : A nonparametric method does not assumean a priori statistical model. Instead, a nonparametric method tries todetermine the model from the input data.

Hamid Beigy (Sharif University of Technology) Data Mining Fall 1395 9 / 17

Page 12: Data Miningce.sharif.edu/courses/95-96/1/ce714-1/resources/root/...data analysis, including outlier detection. For example, in credit card fraud detection, For example, in credit card

Statistical methods (Parametric methods)

Suppose average temperature (ascending order) of a city in the last10 years are: 24.0, 28.9, 28.9, 29.0, 29.1, 29.1, 29.2, 29.2, 29.3, and29.4.Assume that the average temperature follows a normal distribution,which is determined by two parameters: the mean, µ, and thestandard deviation, σ.Using maximum likelihood estimates, we obtain

µ̂ =1

n

n∑i=1

xi = 28.61

σ̂2 =1

n

n∑i=1

(xi − µ̂)2 = 2.29

We know that the µ± 3σ region contains 99.7% data under theassumption of normal.The probability that value 24.0 is generated by the normal distributionis less than 0.15%, and thus can be identified as an outlier.

Hamid Beigy (Sharif University of Technology) Data Mining Fall 1395 10 / 17

Page 13: Data Miningce.sharif.edu/courses/95-96/1/ce714-1/resources/root/...data analysis, including outlier detection. For example, in credit card fraud detection, For example, in credit card

Statistical methods (Nonparametric methods)

In nonparametric methods for outlier detection, the model of normaldata is learned from the input data, rather than assuming one a priori.Nonparametric methods often make fewer assumptions about thedata, and thus can be applicable in more scenarios

HAN 19-ch12-543-584-9780123814791 2011/6/1 3:25 Page 558 #16

558 Chapter 12 Outlier Detection

To tackle the problem demonstrated in Example 12.12, we can assume that the nor-mal data objects are generated by a normal distribution, or a mixture of normal distri-butions, whereas the outliers are generated by another distribution. Heuristically, we canadd constraints on the distribution that is generating outliers. For example, it is reason-able to assume that this distribution has a larger variance if the outliers are distributed ina larger area. Technically, we can assign �outlier = k� , where k is a user-specified param-eter and � is the standard deviation of the normal distribution generating the normaldata. Again, the EM algorithm can be used to learn the parameters.

12.3.2 Nonparametric MethodsIn nonparametric methods for outlier detection, the model of “normal data” is learnedfrom the input data, rather than assuming one a priori. Nonparametric methods oftenmake fewer assumptions about the data, and thus can be applicable in more scenarios.

Example 12.13 Outlier detection using a histogram. AllElectronics records the purchase amountfor every customer transaction. Figure 12.5 uses a histogram (refer to Chapters 2 and3) to graph these amounts as percentages, given all transactions. For example, 60% ofthe transaction amounts are between $0.00 and $1000.

We can use the histogram as a nonparametric statistical model to capture outliers. Forexample, a transaction in the amount of $7500 can be regarded as an outlier becauseonly 1 � (60% + 20% + 10% + 6.7% + 3.1%) = 0.2% of transactions have an amounthigher than $5000. On the other hand, a transaction amount of $385 can be treated asnormal because it falls into the bin (or bucket) holding 60% of the transactions.

20%

00−1 1−2 2−3 3−4 4−5

Amount per transaction

× $1000

10%6.7%

3.1%

60%

Figure 12.5 Histogram of purchase amounts in transactions.A transaction in the amount of 7500 can be regarded as an outlierbecause only 0.2% of transactions have an amount higher than 5000.

Transaction amount of 385 can be treated as normal because it fallsinto the bin (or bucket) holding 60% of the transactions.

Hamid Beigy (Sharif University of Technology) Data Mining Fall 1395 11 / 17

Page 14: Data Miningce.sharif.edu/courses/95-96/1/ce714-1/resources/root/...data analysis, including outlier detection. For example, in credit card fraud detection, For example, in credit card

Proximity-based methods

In these methods, a distance measure used to quantify the similaritybetween objects.

Objects that are far from others can be regarded as outliers.

These methods assume that the proximity of an outlier object to itsnearest neighbors significantly deviates from the proximity of theobject to most of the other objects in the data set.

There are two types of proximity-based outlier detection methods:

Distance-based methods : A distance-based outlier detection methodconsults the neighborhood of an object, which is defined by a givenradius. An object is then considered an outlier if its neighborhood doesnot have enough other points.Density-based methods : A density-based outlier detection methodinvestigates the density of an object and that of its neighbors. Here, anobject is identified as an outlier if its density is relatively much lowerthan that of its neighbors.

Hamid Beigy (Sharif University of Technology) Data Mining Fall 1395 12 / 17

Page 15: Data Miningce.sharif.edu/courses/95-96/1/ce714-1/resources/root/...data analysis, including outlier detection. For example, in credit card fraud detection, For example, in credit card

Clustering-based methods

The notion of outliers is highly related to that of clusters.

Clustering-based approaches detect outliers by examining therelationship between objects and clusters.

An outlier is an object that belongs to a small and remote cluster, ordoes not belong to any cluster.

HAN 19-ch12-543-584-9780123814791 2011/6/1 3:25 Page 570 #28

570 Chapter 12 Outlier Detection

CBLOF defines the similarity between a point and a cluster in a statistical way thatrepresents the probability that the point belongs to the cluster. The larger the value, themore similar the point and the cluster are. The CBLOF score can detect outlier pointsthat are far from any clusters. In addition, small clusters that are far from any largecluster are considered to consist of outliers. The points with the lowest CBLOF scoresare suspected outliers.

Example 12.18 Detecting outliers in small clusters. The data points in Figure 12.12 form three clusters:large clusters, C1 and C2, and a small cluster, C3. Object o does not belong to any cluster.

Using CBLOF, FindCBLOF can identify o as well as the points in cluster C3 as outliers.For o, the closest large cluster is C1. The CBLOF is simply the similarity between o andC1, which is small. For the points in C3, the closest large cluster is C2. Although thereare three points in cluster C3, the similarity between those points and cluster C2 is low,and |C3| = 3 is small; thus, the CBLOF scores of points in C3 are small.

Clustering-based approaches may incur high computational costs if they have to findclusters before detecting outliers. Several techniques have been developed for improvedefficiency. For example, fixed-width clustering is a linear-time technique that is used insome outlier detection methods. The idea is simple yet efficient. A point is assigned toa cluster if the center of the cluster is within a predefined distance threshold from thepoint. If a point cannot be assigned to any existing cluster, a new cluster is created. Thedistance threshold may be learned from the training data under certain conditions.

Clustering-based outlier detection methods have the following advantages. First, theycan detect outliers without requiring any labeled data, that is, in an unsupervised way.They work for many data types. Clusters can be regarded as summaries of the data.Once the clusters are obtained, clustering-based methods need only compare any objectagainst the clusters to determine whether the object is an outlier. This process is typicallyfast because the number of clusters is usually small compared to the total number ofobjects.

o

C1

C2

C3

Figure 12.12 Outliers in small clusters.

Hamid Beigy (Sharif University of Technology) Data Mining Fall 1395 13 / 17

Page 16: Data Miningce.sharif.edu/courses/95-96/1/ce714-1/resources/root/...data analysis, including outlier detection. For example, in credit card fraud detection, For example, in credit card

Classification-based methods

Outlier detection can be treated as a classification problem if atraining data set with class labels is available.The general idea of classification-based outlier detection methods isto train a classification model that can distinguish normal data fromoutliers.

HAN 19-ch12-543-584-9780123814791 2011/6/1 3:25 Page 572 #30

572 Chapter 12 Outlier Detection

Figure 12.13 Learning a model for the normal class.

Objects without labelObjects with label “normal” Objects with label “outlier”

C

C1

a

Figure 12.14 Detecting outliers by semi-supervised learning.

class is regarded as normal. To detect outlier cases, AllElectronics can learn a model foreach normal class. To determine whether a case is an outlier, we can run each model onthe case. If the case does not fit any of the models, then it is declared an outlier.

Classification-based methods and clustering-based methods can be combined todetect outliers in a semi-supervised learning way.

Example 12.20 Outlier detection by semi-supervised learning. Consider Figure 12.14, where objectsare labeled as either “normal” or “outlier,” or have no label at all. Using a clustering-based approach, we find a large cluster, C, and a small cluster, C1. Because some objectsin C carry the label “normal,” we can treat all objects in this cluster (including thosewithout labels) as normal objects. We use the one-class model of this cluster to identifynormal objects in outlier detection. Similarly, because some objects in cluster C1 carrythe label “outlier,” we declare all objects in C1 as outliers. Any object that does not fallinto the model for C (e.g., a) is considered an outlier as well.

Hamid Beigy (Sharif University of Technology) Data Mining Fall 1395 14 / 17

Page 17: Data Miningce.sharif.edu/courses/95-96/1/ce714-1/resources/root/...data analysis, including outlier detection. For example, in credit card fraud detection, For example, in credit card

Table of contents

1 Introduction

2 Outlier detection methodsStatistical methodsProximity-based methodsClustering-based methodsClassification-based methods

3 Mining contextual outliers

4 Mining collective outliers

5 Reading

Hamid Beigy (Sharif University of Technology) Data Mining Fall 1395 15 / 17

Page 18: Data Miningce.sharif.edu/courses/95-96/1/ce714-1/resources/root/...data analysis, including outlier detection. For example, in credit card fraud detection, For example, in credit card

Mining contextual outliers

An object in a given data set is a contextual outlier if it deviatessignificantly with respect to a specific context of the object.

The context is defined using contextual attributes. These dependheavily on the application, and are often provided by users as part ofthe contextual outlier detection task.

These methods usally transform the contextual outlier detectionproblem into a typical outlier detection problem.

Specifically, for a given data object, we can evaluate whether theobject is an outlier in two steps.

1 In the first step, we identify the context of the object using thecontextual attributes.

2 In the second step, we calculate the outlier score for the object in thecontext using a conventional outlier detection method.

Hamid Beigy (Sharif University of Technology) Data Mining Fall 1395 15 / 17

Page 19: Data Miningce.sharif.edu/courses/95-96/1/ce714-1/resources/root/...data analysis, including outlier detection. For example, in credit card fraud detection, For example, in credit card

Table of contents

1 Introduction

2 Outlier detection methodsStatistical methodsProximity-based methodsClustering-based methodsClassification-based methods

3 Mining contextual outliers

4 Mining collective outliers

5 Reading

Hamid Beigy (Sharif University of Technology) Data Mining Fall 1395 16 / 17

Page 20: Data Miningce.sharif.edu/courses/95-96/1/ce714-1/resources/root/...data analysis, including outlier detection. For example, in credit card fraud detection, For example, in credit card

Mining collective outliers

A group of data objects forms a collective outlier if the objects as awhole deviate significantly from the entire data set, even though eachindividual object in the group may not be an outlier.

To detect collective outliers, we have to examine the structure of thedata set, that is, the relationships between multiple data objects.

The structure of the data set typically depends on the nature of thedata.

For outlier detection in temporal data (e.g., time series andsequences), we explore the structures formed by time, which occur insegments of the time series or sub- sequences.

To detect collective outliers in spatial data, we explore local areas.

In graph and network data, we explore subgraphs. Each of thesestructures is inherent to its respective data type.

Hamid Beigy (Sharif University of Technology) Data Mining Fall 1395 16 / 17

Page 21: Data Miningce.sharif.edu/courses/95-96/1/ce714-1/resources/root/...data analysis, including outlier detection. For example, in credit card fraud detection, For example, in credit card

Table of contents

1 Introduction

2 Outlier detection methodsStatistical methodsProximity-based methodsClustering-based methodsClassification-based methods

3 Mining contextual outliers

4 Mining collective outliers

5 Reading

Hamid Beigy (Sharif University of Technology) Data Mining Fall 1395 17 / 17

Page 22: Data Miningce.sharif.edu/courses/95-96/1/ce714-1/resources/root/...data analysis, including outlier detection. For example, in credit card fraud detection, For example, in credit card

Reading

Read chapter 12 of the following bookJ. Han, M. Kamber, and Jian Pei, Data Mining: Concepts andTechniques, Morgan Kaufmann, 2012.

Hamid Beigy (Sharif University of Technology) Data Mining Fall 1395 17 / 17


Recommended