SlideShare une entreprise Scribd logo
1  sur  24
Data Mining
Anomaly Detection

Lecture Notes for Chapter 10
Introduction to Data Mining
by
Tan, Steinbach, Kumar

© Tan,Steinbach, Kumar

Introduction to Data Mining

4/18/2004

1
Anomaly/Outlier Detection
What are anomalies/outliers?
– The set of data points that are considerably different than the
remainder of the data

Variants of Anomaly/Outlier Detection Problems
– Given a database D, find all the data points x ∈ D with anomaly
scores greater than some threshold t
– Given a database D, find all the data points x ∈ D having the topn largest anomaly scores f(x)
– Given a database D, containing mostly normal (but unlabeled)
data points, and a test point x, compute the anomaly score of x
with respect to D

Applications:
– Credit card fraud detection, telecommunication fraud detection,
network intrusion detection, fault detection
© Tan,Steinbach, Kumar

Introduction to Data Mining

4/18/2004

2
Importance of Anomaly Detection
Ozone Depletion History
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
Why did the Nimbus 7 satellite,
which had instruments aboard for
recording ozone levels, not record
similarly low ozone concentrations?
The ozone concentrations recorded
by the satellite were so low they
were being treated as outliers by a
computer program and discarded!

© Tan,Steinbach, Kumar

Sources:
http://exploringdata.cqu.edu.au/ozone.html
http://www.epa.gov/ozone/science/hole/size.html

Introduction to Data Mining

4/18/2004

3
Anomaly Detection
Challenges
– How many outliers are there in the data?
– Method is unsupervised


Validation can be quite challenging (just like for clustering)

– Finding needle in a haystack

Working assumption:
– There are considerably more “normal” observations
than “abnormal” observations (outliers/anomalies) in
the data

© Tan,Steinbach, Kumar

Introduction to Data Mining

4/18/2004

4
Anomaly Detection Schemes
General Steps
– Build a profile of the “normal” behavior


Profile can be patterns or summary statistics for the overall population

– Use the “normal” profile to detect anomalies


Anomalies are observations whose characteristics
differ significantly from the normal profile

Types of anomaly detection
schemes
– Graphical & Statistical-based
– Distance-based
– Model-based

© Tan,Steinbach, Kumar

Introduction to Data Mining

4/18/2004

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

© Tan,Steinbach, Kumar

Introduction to Data Mining

4/18/2004

6
Convex Hull Method
Extreme points are assumed to be outliers
Use convex hull method to detect extreme values

What if the outlier occurs in the middle of the
data?
© Tan,Steinbach, Kumar

Introduction to Data Mining

4/18/2004

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

© Tan,Steinbach, Kumar

Introduction to Data Mining

4/18/2004

8
Grubbs’ Test
Detect outliers in univariate data
Assume data comes from normal distribution
Detects one outlier at a time, remove the outlier,
and repeat
– H0: There is no outlier in data
– HA: There is at least one outlier

Grubbs’ test statistic:
Reject H0 if:
© Tan,Steinbach, Kumar

( N − 1)
G>
N

G=

max X − X
s
t (2α / N , N − 2 )

N − 2 + t (2α / N , N − 2 )

Introduction to Data Mining

4/18/2004

9
Statistical-based – Likelihood
Approach
Assume the data set D contains samples from a
mixture of two probability distributions:
– M (majority distribution)
– A (anomalous distribution)

General Approach:
– Initially, assume all the data points belong to M
– Let Lt(D) be the log likelihood of D at time t
– For each point xt that belongs to M, move it to A


Let Lt+1 (D) be the new log likelihood.



Compute the difference, ∆ = Lt(D) – Lt+1 (D)

If ∆ > c (some threshold), then xt is declared as an anomaly
and moved permanently from M to A


© Tan,Steinbach, Kumar

Introduction to Data Mining

4/18/2004

10
Statistical-based – Likelihood
Approach
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 initially assumed to be uniform distribution
Likelihood at time t:

 |At |

|M t |
Lt ( D ) = ∏ PD ( xi ) =  (1 − λ ) ∏ PM t ( xi )  λ ∏ PAt ( xi ) 

  x ∈A

i =1
xi ∈M t
i
t



LLt ( D ) = M t log(1 − λ ) + ∑ log PM t ( xi ) + At log λ + ∑ log PAt ( xi )
N

xi ∈M t

© Tan,Steinbach, Kumar

Introduction to Data Mining

xi ∈At

4/18/2004

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

© Tan,Steinbach, Kumar

Introduction to Data Mining

4/18/2004

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

© Tan,Steinbach, Kumar

Introduction to Data Mining

4/18/2004

13
Nearest-Neighbor Based Approach
Approach:
– Compute the distance between every pair of data
points
– There are various ways to define outliers:
 Data

points for which there are fewer than p neighboring
points within a distance D

 The

top n data points whose distance to the kth nearest
neighbor is greatest

 The

top n data points whose average distance to the k
nearest neighbors is greatest

© Tan,Steinbach, Kumar

Introduction to Data Mining

4/18/2004

14
Outliers in Lower Dimensional
Projection
Divide each attribute into φ equal-depth intervals
– Each interval contains a fraction f = 1/φ of the records

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 fk 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
© Tan,Steinbach, Kumar

Introduction to Data Mining

4/18/2004

16
Example
N=100, φ = 5, f = 1/5 = 0.2, N × f2 = 4

© Tan,Steinbach, Kumar

Introduction to Data Mining

4/18/2004

17
Density-based: LOF approach
For each point, compute the density of its local neighborhood
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
Outliers are points with largest LOF value

×

In the NN approach, p2 is
not considered as outlier,
while LOF approach find
both p1 and p2 as outliers

p2
×

© Tan,Steinbach, Kumar

p1

Introduction to Data Mining

4/18/2004

18
Clustering-Based
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 noncandidate points, they are
outliers

© Tan,Steinbach, Kumar

Introduction to Data Mining

4/18/2004

19
Base Rate Fallacy
Bayes theorem:

More generally:

© Tan,Steinbach, Kumar

Introduction to Data Mining

4/18/2004

20
Base Rate Fallacy (Axelsson, 1999)

© Tan,Steinbach, Kumar

Introduction to Data Mining

4/18/2004

21
Base Rate Fallacy

Even though the test is 99% certain, your chance
of having the disease is 1/100, because the
population of healthy people is much larger than
sick people
© Tan,Steinbach, Kumar

Introduction to Data Mining

4/18/2004

22
Base Rate Fallacy in Intrusion
Detection
I: intrusive behavior,
¬I: non-intrusive behavior
A: alarm
¬A: no alarm
Detection rate (true positive rate): P(A|I)
False alarm rate: P(A|¬I)
Goal is to maximize both
– Bayesian detection rate, P(I|A)
– P(¬I|¬A)
© Tan,Steinbach, Kumar

Introduction to Data Mining

4/18/2004

23
Detection Rate vs False Alarm Rate

Suppose:
Then:

False alarm rate becomes more dominant if P(I)
is very low
© Tan,Steinbach, Kumar

Introduction to Data Mining

4/18/2004

24
Detection Rate vs False Alarm Rate

Axelsson: We need a very low false alarm rate to achieve
a reasonable Bayesian detection rate
© Tan,Steinbach, Kumar

Introduction to Data Mining

4/18/2004

25

Contenu connexe

Tendances

The science behind predictive analytics a text mining perspective
The science behind predictive analytics  a text mining perspectiveThe science behind predictive analytics  a text mining perspective
The science behind predictive analytics a text mining perspective
ankurpandeyinfo
 
slides
slidesslides
slides
butest
 
Bayes’ theorem and logistic regression
Bayes’ theorem and logistic regressionBayes’ theorem and logistic regression
Bayes’ theorem and logistic regression
Ujjawal
 
Handout11
Handout11Handout11
Handout11
butest
 

Tendances (18)

Outlier analysis,Chapter-12, Data Mining: Concepts and Techniques
Outlier analysis,Chapter-12, Data Mining: Concepts and TechniquesOutlier analysis,Chapter-12, Data Mining: Concepts and Techniques
Outlier analysis,Chapter-12, Data Mining: Concepts and Techniques
 
Introduction to unsupervised learning: outlier detection
Introduction to unsupervised learning: outlier detectionIntroduction to unsupervised learning: outlier detection
Introduction to unsupervised learning: outlier detection
 
Chapter 12 outlier
Chapter 12 outlierChapter 12 outlier
Chapter 12 outlier
 
Outlier Detection
Outlier DetectionOutlier Detection
Outlier Detection
 
Data Mining: Outlier analysis
Data Mining: Outlier analysisData Mining: Outlier analysis
Data Mining: Outlier analysis
 
Anomaly Detection Technique
Anomaly Detection TechniqueAnomaly Detection Technique
Anomaly Detection Technique
 
12 outlier
12 outlier12 outlier
12 outlier
 
Missing Data and data imputation techniques
Missing Data and data imputation techniquesMissing Data and data imputation techniques
Missing Data and data imputation techniques
 
The science behind predictive analytics a text mining perspective
The science behind predictive analytics  a text mining perspectiveThe science behind predictive analytics  a text mining perspective
The science behind predictive analytics a text mining perspective
 
Textmining Predictive Models
Textmining Predictive ModelsTextmining Predictive Models
Textmining Predictive Models
 
Machine learning algorithms for data mining
Machine learning algorithms for data miningMachine learning algorithms for data mining
Machine learning algorithms for data mining
 
slides
slidesslides
slides
 
Bayes’ theorem and logistic regression
Bayes’ theorem and logistic regressionBayes’ theorem and logistic regression
Bayes’ theorem and logistic regression
 
Health-e-Child CaseReasoner
Health-e-Child CaseReasonerHealth-e-Child CaseReasoner
Health-e-Child CaseReasoner
 
Exploratory data analysis
Exploratory data analysisExploratory data analysis
Exploratory data analysis
 
Rohit 10103543
Rohit 10103543Rohit 10103543
Rohit 10103543
 
Exploratory data analysis
Exploratory data analysis Exploratory data analysis
Exploratory data analysis
 
Handout11
Handout11Handout11
Handout11
 

En vedette (9)

Chap1 intro
Chap1 introChap1 intro
Chap1 intro
 
Anomaly Detection
Anomaly DetectionAnomaly Detection
Anomaly Detection
 
Artificial neural network for misuse detection
Artificial neural network for misuse detectionArtificial neural network for misuse detection
Artificial neural network for misuse detection
 
Chapter 4 Classification
Chapter 4 ClassificationChapter 4 Classification
Chapter 4 Classification
 
Anomaly Detection
Anomaly DetectionAnomaly Detection
Anomaly Detection
 
Anomaly detection, part 1
Anomaly detection, part 1Anomaly detection, part 1
Anomaly detection, part 1
 
Anomaly Detection
Anomaly DetectionAnomaly Detection
Anomaly Detection
 
Computer Aided Process Planning
Computer Aided Process PlanningComputer Aided Process Planning
Computer Aided Process Planning
 
Satellite communication
Satellite communicationSatellite communication
Satellite communication
 

Similaire à Anomaly detection

Data Mining Anomaly DetectionLecture Notes for Chapt.docx
Data Mining Anomaly DetectionLecture Notes for Chapt.docxData Mining Anomaly DetectionLecture Notes for Chapt.docx
Data Mining Anomaly DetectionLecture Notes for Chapt.docx
randyburney60861
 
AnomalyOutlier DetectionWhat are anomaliesoutliersThe set.docx
AnomalyOutlier DetectionWhat are anomaliesoutliersThe set.docxAnomalyOutlier DetectionWhat are anomaliesoutliersThe set.docx
AnomalyOutlier DetectionWhat are anomaliesoutliersThe set.docx
amrit47
 

Similaire à Anomaly detection (20)

chap9_anomaly_detection.pptx
chap9_anomaly_detection.pptxchap9_anomaly_detection.pptx
chap9_anomaly_detection.pptx
 
Data Mining Anomaly DetectionLecture Notes for Chapt.docx
Data Mining Anomaly DetectionLecture Notes for Chapt.docxData Mining Anomaly DetectionLecture Notes for Chapt.docx
Data Mining Anomaly DetectionLecture Notes for Chapt.docx
 
AnomalyOutlier DetectionWhat are anomaliesoutliersThe set.docx
AnomalyOutlier DetectionWhat are anomaliesoutliersThe set.docxAnomalyOutlier DetectionWhat are anomaliesoutliersThe set.docx
AnomalyOutlier DetectionWhat are anomaliesoutliersThe set.docx
 
03 presentation-bothiesson
03 presentation-bothiesson03 presentation-bothiesson
03 presentation-bothiesson
 
3.7 outlier analysis
3.7 outlier analysis3.7 outlier analysis
3.7 outlier analysis
 
Data_exploration.ppt
Data_exploration.pptData_exploration.ppt
Data_exploration.ppt
 
Isolation Forest
Isolation ForestIsolation Forest
Isolation Forest
 
Data Science and Analytics Brown Bag
Data Science and Analytics Brown BagData Science and Analytics Brown Bag
Data Science and Analytics Brown Bag
 
Data Tactics Data Science Brown Bag (April 2014)
Data Tactics Data Science Brown Bag (April 2014)Data Tactics Data Science Brown Bag (April 2014)
Data Tactics Data Science Brown Bag (April 2014)
 
The tale of heavy tails in computer networking
The tale of heavy tails in computer networkingThe tale of heavy tails in computer networking
The tale of heavy tails in computer networking
 
Environmental statistics
Environmental statisticsEnvironmental statistics
Environmental statistics
 
chap8_basic_cluster_analysis.ppt
chap8_basic_cluster_analysis.pptchap8_basic_cluster_analysis.ppt
chap8_basic_cluster_analysis.ppt
 
Data wrangling week 10
Data wrangling week 10Data wrangling week 10
Data wrangling week 10
 
Fahroo - Optimization and Discrete Mathematics - Spring Review 2013
Fahroo - Optimization and Discrete Mathematics - Spring Review 2013Fahroo - Optimization and Discrete Mathematics - Spring Review 2013
Fahroo - Optimization and Discrete Mathematics - Spring Review 2013
 
Detection of Outliers in Large Dataset using Distributed Approach
Detection of Outliers in Large Dataset using Distributed ApproachDetection of Outliers in Large Dataset using Distributed Approach
Detection of Outliers in Large Dataset using Distributed Approach
 
Outlier Detection Using Unsupervised Learning on High Dimensional Data
Outlier Detection Using Unsupervised Learning on High Dimensional DataOutlier Detection Using Unsupervised Learning on High Dimensional Data
Outlier Detection Using Unsupervised Learning on High Dimensional Data
 
Spatial data analysis 1
Spatial data analysis 1Spatial data analysis 1
Spatial data analysis 1
 
Datascience Introduction WebSci Summer School 2014
Datascience Introduction WebSci Summer School 2014Datascience Introduction WebSci Summer School 2014
Datascience Introduction WebSci Summer School 2014
 
Surface-related multiple elimination through orthogonal encoding in the laten...
Surface-related multiple elimination through orthogonal encoding in the laten...Surface-related multiple elimination through orthogonal encoding in the laten...
Surface-related multiple elimination through orthogonal encoding in the laten...
 
Dia sds2015 web version
Dia sds2015 web versionDia sds2015 web version
Dia sds2015 web version
 

Plus de Institute of Technology Telkom

Plus de Institute of Technology Telkom (20)

Econopysics
EconopysicsEconopysics
Econopysics
 
Science and religion 100622120615-phpapp01
Science and religion 100622120615-phpapp01Science and religion 100622120615-phpapp01
Science and religion 100622120615-phpapp01
 
Konvergensi sains dan_spiritualitas
Konvergensi sains dan_spiritualitasKonvergensi sains dan_spiritualitas
Konvergensi sains dan_spiritualitas
 
Matematika arah kiblat mikrajuddin abdullah 2017
Matematika arah kiblat   mikrajuddin abdullah 2017Matematika arah kiblat   mikrajuddin abdullah 2017
Matematika arah kiblat mikrajuddin abdullah 2017
 
Iau solar effects 2005
Iau solar effects 2005Iau solar effects 2005
Iau solar effects 2005
 
Hfmsilri2jun14
Hfmsilri2jun14Hfmsilri2jun14
Hfmsilri2jun14
 
Fisika komputasi
Fisika komputasiFisika komputasi
Fisika komputasi
 
Archimedes
ArchimedesArchimedes
Archimedes
 
Web and text
Web and textWeb and text
Web and text
 
Web data mining
Web data miningWeb data mining
Web data mining
 
Time series Forecasting using svm
Time series Forecasting using  svmTime series Forecasting using  svm
Time series Forecasting using svm
 
Timeseries forecasting
Timeseries forecastingTimeseries forecasting
Timeseries forecasting
 
Fuzzy logic
Fuzzy logicFuzzy logic
Fuzzy logic
 
World population 1950--2050
World population 1950--2050World population 1950--2050
World population 1950--2050
 
neural networks
 neural networks neural networks
neural networks
 
Artificial neural networks
Artificial neural networks Artificial neural networks
Artificial neural networks
 
002 ray modeling dynamic systems
002 ray modeling dynamic systems002 ray modeling dynamic systems
002 ray modeling dynamic systems
 
002 ray modeling dynamic systems
002 ray modeling dynamic systems002 ray modeling dynamic systems
002 ray modeling dynamic systems
 
System dynamics majors fair
System dynamics majors fairSystem dynamics majors fair
System dynamics majors fair
 
System dynamics math representation
System dynamics math representationSystem dynamics math representation
System dynamics math representation
 

Dernier

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Dernier (20)

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

Anomaly detection

  • 1. Data Mining Anomaly Detection Lecture Notes for Chapter 10 Introduction to Data Mining by Tan, Steinbach, Kumar © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 1
  • 2. Anomaly/Outlier Detection What are anomalies/outliers? – The set of data points that are considerably different than the remainder of the data Variants of Anomaly/Outlier Detection Problems – Given a database D, find all the data points x ∈ D with anomaly scores greater than some threshold t – Given a database D, find all the data points x ∈ D having the topn largest anomaly scores f(x) – Given a database D, containing mostly normal (but unlabeled) data points, and a test point x, compute the anomaly score of x with respect to D Applications: – Credit card fraud detection, telecommunication fraud detection, network intrusion detection, fault detection © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 2
  • 3. Importance of Anomaly Detection Ozone Depletion History 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 Why did the Nimbus 7 satellite, which had instruments aboard for recording ozone levels, not record similarly low ozone concentrations? The ozone concentrations recorded by the satellite were so low they were being treated as outliers by a computer program and discarded! © Tan,Steinbach, Kumar Sources: http://exploringdata.cqu.edu.au/ozone.html http://www.epa.gov/ozone/science/hole/size.html Introduction to Data Mining 4/18/2004 3
  • 4. Anomaly Detection Challenges – How many outliers are there in the data? – Method is unsupervised  Validation can be quite challenging (just like for clustering) – Finding needle in a haystack Working assumption: – There are considerably more “normal” observations than “abnormal” observations (outliers/anomalies) in the data © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 4
  • 5. Anomaly Detection Schemes General Steps – Build a profile of the “normal” behavior  Profile can be patterns or summary statistics for the overall population – Use the “normal” profile to detect anomalies  Anomalies are observations whose characteristics differ significantly from the normal profile Types of anomaly detection schemes – Graphical & Statistical-based – Distance-based – Model-based © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 5
  • 6. Graphical Approaches Boxplot (1-D), Scatter plot (2-D), Spin plot (3-D) Limitations – Time consuming – Subjective © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 6
  • 7. Convex Hull Method Extreme points are assumed to be outliers Use convex hull method to detect extreme values What if the outlier occurs in the middle of the data? © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 7
  • 8. Statistical Approaches Assume a parametric model describing the distribution of the data (e.g., normal distribution) Apply a statistical test that depends on – Data distribution – Parameter of distribution (e.g., mean, variance) – Number of expected outliers (confidence limit) © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 8
  • 9. Grubbs’ Test Detect outliers in univariate data Assume data comes from normal distribution Detects one outlier at a time, remove the outlier, and repeat – H0: There is no outlier in data – HA: There is at least one outlier Grubbs’ test statistic: Reject H0 if: © Tan,Steinbach, Kumar ( N − 1) G> N G= max X − X s t (2α / N , N − 2 ) N − 2 + t (2α / N , N − 2 ) Introduction to Data Mining 4/18/2004 9
  • 10. Statistical-based – Likelihood Approach Assume the data set D contains samples from a mixture of two probability distributions: – M (majority distribution) – A (anomalous distribution) General Approach: – Initially, assume all the data points belong to M – Let Lt(D) be the log likelihood of D at time t – For each point xt that belongs to M, move it to A  Let Lt+1 (D) be the new log likelihood.  Compute the difference, ∆ = Lt(D) – Lt+1 (D) If ∆ > c (some threshold), then xt is declared as an anomaly and moved permanently from M to A  © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 10
  • 11. Statistical-based – Likelihood Approach 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 initially assumed to be uniform distribution Likelihood at time t:   |At |  |M t | Lt ( D ) = ∏ PD ( xi ) =  (1 − λ ) ∏ PM t ( xi )  λ ∏ PAt ( xi )     x ∈A  i =1 xi ∈M t i t    LLt ( D ) = M t log(1 − λ ) + ∑ log PM t ( xi ) + At log λ + ∑ log PAt ( xi ) N xi ∈M t © Tan,Steinbach, Kumar Introduction to Data Mining xi ∈At 4/18/2004 11
  • 12. Limitations of Statistical Approaches Most of the tests are for a single attribute In many cases, data distribution may not be known For high dimensional data, it may be difficult to estimate the true distribution © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 12
  • 13. Distance-based Approaches Data is represented as a vector of features Three major approaches – Nearest-neighbor based – Density based – Clustering based © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 13
  • 14. Nearest-Neighbor Based Approach Approach: – Compute the distance between every pair of data points – There are various ways to define outliers:  Data points for which there are fewer than p neighboring points within a distance D  The top n data points whose distance to the kth nearest neighbor is greatest  The top n data points whose average distance to the k nearest neighbors is greatest © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 14
  • 15. Outliers in Lower Dimensional Projection Divide each attribute into φ equal-depth intervals – Each interval contains a fraction f = 1/φ of the records 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 fk 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 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 16
  • 16. Example N=100, φ = 5, f = 1/5 = 0.2, N × f2 = 4 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 17
  • 17. Density-based: LOF approach For each point, compute the density of its local neighborhood 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 Outliers are points with largest LOF value × In the NN approach, p2 is not considered as outlier, while LOF approach find both p1 and p2 as outliers p2 × © Tan,Steinbach, Kumar p1 Introduction to Data Mining 4/18/2004 18
  • 18. Clustering-Based 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 noncandidate points, they are outliers © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 19
  • 19. Base Rate Fallacy Bayes theorem: More generally: © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 20
  • 20. Base Rate Fallacy (Axelsson, 1999) © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 21
  • 21. Base Rate Fallacy Even though the test is 99% certain, your chance of having the disease is 1/100, because the population of healthy people is much larger than sick people © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 22
  • 22. Base Rate Fallacy in Intrusion Detection I: intrusive behavior, ¬I: non-intrusive behavior A: alarm ¬A: no alarm Detection rate (true positive rate): P(A|I) False alarm rate: P(A|¬I) Goal is to maximize both – Bayesian detection rate, P(I|A) – P(¬I|¬A) © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 23
  • 23. Detection Rate vs False Alarm Rate Suppose: Then: False alarm rate becomes more dominant if P(I) is very low © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 24
  • 24. Detection Rate vs False Alarm Rate Axelsson: We need a very low false alarm rate to achieve a reasonable Bayesian detection rate © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 25