SlideShare a Scribd company logo
15. Anomaly Detection
≫ PROBLEM MOTIVATION:
Inputs:
Test Data:
Plot:
Problem: we are given some training examples. We assume them
to be NON-ANOMALOUS. So, we need to find if a new example is
anomalous or not.
We train a PROBABILITY MODEL:
It divides the plot into various regions, such that each region
corresponds to a level of provability.
Centre → highest probability
Outside → lowest P
Example:
≫ GAUSSIAN DISTRIBUTION:
Examples:
σ → controls the width and height of curve
µ → mean of all values of x: controls the center..
Area below the curve is always = 1
So, the curve is either taller or wider.
Estimation of µ and σ :
≫ ALGORITHM FOR ANOMALY DETECTION:
Each feature can be individually distributred using
Normal(Gaussian) distribution:
P( x ) = product of probabilities of individual features
Note:
Steps of algorithm:
Example:
Gaussian Curves of both features:
P( x ) → height of curve == P(x1 ; µ1 , σ2
2) x P(x2 ; µ2 , σ2
2)
For a new example:
This means that anything below a particular height in the plot,
given by ϵ : is an anomaly
OR
Anything outside the learned region is an anomaly:
i.e., everything outside the magenta curve:
≫ DEVELOPING ANOMALY DETECTION SYSTEM:
Anomaly detection system problem can be converted to a likes of
Supervised Learning problem.
Therefore:
Thus we can take:
Meaning all the training set examples are non-anomalous
In Cross validation set and test set, we can have some examples of
anomalous (y=1) and some of non-anomalous (y=0) type:
Example:
≫ How to evaluate the algorithm:
≫ How to choose ϵ :
We can choose the value of ϵ which gives the best value of F1 score.
Anomaly detection vs Supervised Learning:
In anomaly detection, it’s better to model anomalies based on
negative examples, rather than positive examples… as future
anomalies may be totally different.
Applications of Anomaly detection vs Supervised Learning:
Fraud detection can be a supervised learning application but only if
there are a lot of people on the website who are doing fraudulent
activity, i.e., most of the examples are positive, otherwise, it’s an
anomaly detection problem only
≫ Choosing what features to use:
We plot the data and the histogram looks like :
We’d be happy to see this as this means that the feature x is a
gaussian feature
But: if the histogram looks like:
This is a non gaussian distribution
So, we use different transforms on our data to make it as close as
possible to a gaussian distribution:
➔ These are feature v/s P( x )
We can use different transforms for different features to make
them gaussian features:
We may have to try out different transforms for the same feature
to find the best (which gives the best gaussian look to the data).
These parameters in the red are parameters we can vary to make
the data look more and more Gaussian.
≫ Coming up with features:
Error analysis method:
If there is an anomalous example in middle of some non-anomalous
examples, then the algo will fail.
➢So, we can look at that particular example and try to come up
with a new feature that can tell what went wrong with that
example
Example:
It may occur that if one of the computers is stuck in an infinite loop,
the CPU load grows but the network traffic doesn’t:
Then we can come up with a new feature:
OR
≫ MULTIVARIATE GAUSSIAN DISTRIBUTION:
Here, red points are training data
Green point is our test data
➢Lets look at both features individually:
The algo will not predict the right o/p … since the i/p data is
distributed on the whole axis, so all the points have some
probability of being correct.
Probability Contours:
To solve this:
Examples:
If we decr Σ :
If we incr Σ :
If we decr the variance of only one of the features:
OR
If we incr the variance of only one of the features:
OR
Other variations in Σ :
Varying the mean ( µ ): it moves the centre of contours, where
the probability ( P( x ) ) is highest.
≫ Multivariate Gaussian Distribution Algorithm:
Algorithm:
≫ Relationship of multivariate Gaussian Model with
Original Gaussian Model:
Original gaussian model is actually a special case of multivariate
model, in which, the contours have their axes aligned with the
features axes, i.e., the contours are not at nay angles:
Original model is mathematically the multivariate model with a
constraint, that is:
≫ WHEN TO USE ORIGINAL MODEL vs MULTIVARIATE MODEL:
➢In some cases, in original model, we may require to manually
create extra features, so that the model can work fine.
➢In case of multivariate model, its important to get rid of
redundant features, o/w the algo is very expensive, and Σ may
even be non-invertible
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………

More Related Content

What's hot

9 neural network learning
9 neural network learning9 neural network learning
9 neural network learning
TanmayVijay1
 
6 logistic regression classification algo
6 logistic regression   classification algo6 logistic regression   classification algo
6 logistic regression classification algo
TanmayVijay1
 
10 advice for applying ml
10 advice for applying ml10 advice for applying ml
10 advice for applying ml
TanmayVijay1
 
7 regularization
7 regularization7 regularization
7 regularization
TanmayVijay1
 
U6 Cn2 Definite Integrals Intro
U6 Cn2 Definite Integrals IntroU6 Cn2 Definite Integrals Intro
U6 Cn2 Definite Integrals IntroAlexander Burt
 
Logistic regression in Machine Learning
Logistic regression in Machine LearningLogistic regression in Machine Learning
Logistic regression in Machine Learning
Kuppusamy P
 
Lecture two
Lecture twoLecture two
Lecture two
Mahmoud Hussein
 
Chapter 2 continuous_random_variable_2009
Chapter 2 continuous_random_variable_2009Chapter 2 continuous_random_variable_2009
Chapter 2 continuous_random_variable_2009ayimsevenfold
 
Riemann's Sum
Riemann's SumRiemann's Sum
Riemann's Sum
KennethEaves
 
R nonlinear least square
R   nonlinear least squareR   nonlinear least square
R nonlinear least square
Learnbay Datascience
 
Teknik Simulasi
Teknik SimulasiTeknik Simulasi
Teknik Simulasi
Rezzy Caraka
 
Simplex Method Flowchart/Algorithm
Simplex Method Flowchart/AlgorithmSimplex Method Flowchart/Algorithm
Simplex Method Flowchart/Algorithm
Raja Adapa
 
Monte carlo simulation
Monte carlo simulationMonte carlo simulation
Monte carlo simulation
Anurag Jaiswal
 
Monte carlo-simulation
Monte carlo-simulationMonte carlo-simulation
Monte carlo-simulation
jaimarbustos
 
Numerical approximation
Numerical approximationNumerical approximation
Numerical approximationMileacre
 
MolinaLeydi_FinalProject
MolinaLeydi_FinalProjectMolinaLeydi_FinalProject
MolinaLeydi_FinalProjectLeydi Molina
 
Regression Analysis and model comparison on the Boston Housing Data
Regression Analysis and model comparison on the Boston Housing DataRegression Analysis and model comparison on the Boston Housing Data
Regression Analysis and model comparison on the Boston Housing Data
Shivaram Prakash
 
simplex method
simplex methodsimplex method
simplex method
Karishma Chaudhary
 
Random number generation
Random number generationRandom number generation
Random number generation
Vinit Dantkale
 

What's hot (20)

9 neural network learning
9 neural network learning9 neural network learning
9 neural network learning
 
6 logistic regression classification algo
6 logistic regression   classification algo6 logistic regression   classification algo
6 logistic regression classification algo
 
10 advice for applying ml
10 advice for applying ml10 advice for applying ml
10 advice for applying ml
 
7 regularization
7 regularization7 regularization
7 regularization
 
U6 Cn2 Definite Integrals Intro
U6 Cn2 Definite Integrals IntroU6 Cn2 Definite Integrals Intro
U6 Cn2 Definite Integrals Intro
 
Logistic regression in Machine Learning
Logistic regression in Machine LearningLogistic regression in Machine Learning
Logistic regression in Machine Learning
 
Lecture two
Lecture twoLecture two
Lecture two
 
Chapter 2 continuous_random_variable_2009
Chapter 2 continuous_random_variable_2009Chapter 2 continuous_random_variable_2009
Chapter 2 continuous_random_variable_2009
 
Calc 2.1
Calc 2.1Calc 2.1
Calc 2.1
 
Riemann's Sum
Riemann's SumRiemann's Sum
Riemann's Sum
 
R nonlinear least square
R   nonlinear least squareR   nonlinear least square
R nonlinear least square
 
Teknik Simulasi
Teknik SimulasiTeknik Simulasi
Teknik Simulasi
 
Simplex Method Flowchart/Algorithm
Simplex Method Flowchart/AlgorithmSimplex Method Flowchart/Algorithm
Simplex Method Flowchart/Algorithm
 
Monte carlo simulation
Monte carlo simulationMonte carlo simulation
Monte carlo simulation
 
Monte carlo-simulation
Monte carlo-simulationMonte carlo-simulation
Monte carlo-simulation
 
Numerical approximation
Numerical approximationNumerical approximation
Numerical approximation
 
MolinaLeydi_FinalProject
MolinaLeydi_FinalProjectMolinaLeydi_FinalProject
MolinaLeydi_FinalProject
 
Regression Analysis and model comparison on the Boston Housing Data
Regression Analysis and model comparison on the Boston Housing DataRegression Analysis and model comparison on the Boston Housing Data
Regression Analysis and model comparison on the Boston Housing Data
 
simplex method
simplex methodsimplex method
simplex method
 
Random number generation
Random number generationRandom number generation
Random number generation
 

Similar to 15 anomaly detection

Anomaly detection Full Article
Anomaly detection Full ArticleAnomaly detection Full Article
Anomaly detection Full Article
MenglinLiu1
 
Monte Carlo Berkeley.pptx
Monte Carlo Berkeley.pptxMonte Carlo Berkeley.pptx
Monte Carlo Berkeley.pptx
HaibinSu2
 
Bootcamp of new world to taken seriously
Bootcamp of new world to taken seriouslyBootcamp of new world to taken seriously
Bootcamp of new world to taken seriously
khaled125087
 
Machine learning session4(linear regression)
Machine learning   session4(linear regression)Machine learning   session4(linear regression)
Machine learning session4(linear regression)
Abhimanyu Dwivedi
 
chap4_Parametric_Methods.ppt
chap4_Parametric_Methods.pptchap4_Parametric_Methods.ppt
chap4_Parametric_Methods.ppt
ShayanChowdary
 
Prob and statistics models for outlier detection
Prob and statistics models for outlier detectionProb and statistics models for outlier detection
Prob and statistics models for outlier detection
Trilochan Panigrahi
 
Machine learning (5)
Machine learning (5)Machine learning (5)
Machine learning (5)NYversity
 
Aaa ped-16-Unsupervised Learning: clustering
Aaa ped-16-Unsupervised Learning: clusteringAaa ped-16-Unsupervised Learning: clustering
Aaa ped-16-Unsupervised Learning: clustering
AminaRepo
 
2. diagnostics, collinearity, transformation, and missing data
2. diagnostics, collinearity, transformation, and missing data 2. diagnostics, collinearity, transformation, and missing data
2. diagnostics, collinearity, transformation, and missing data
Malik Hassan Qayyum 🕵🏻‍♂️
 
CounterFactual Explanations.pdf
CounterFactual Explanations.pdfCounterFactual Explanations.pdf
CounterFactual Explanations.pdf
Bong-Ho Lee
 
working with python
working with pythonworking with python
working with python
bhavesh lande
 
Estimating Causal Effects from Observations
Estimating Causal Effects from ObservationsEstimating Causal Effects from Observations
Estimating Causal Effects from Observations
Antigoni-Maria Founta
 
MM - KBAC: Using mixed models to adjust for population structure in a rare-va...
MM - KBAC: Using mixed models to adjust for population structure in a rare-va...MM - KBAC: Using mixed models to adjust for population structure in a rare-va...
MM - KBAC: Using mixed models to adjust for population structure in a rare-va...
Golden Helix Inc
 
SVM - Functional Verification
SVM - Functional VerificationSVM - Functional Verification
SVM - Functional Verification
Sai Kiran Kadam
 
Machine learning introduction lecture notes
Machine learning introduction lecture notesMachine learning introduction lecture notes
Machine learning introduction lecture notes
UmeshJagga1
 
Deep learning concepts
Deep learning conceptsDeep learning concepts
Deep learning concepts
Joe li
 
PRML Chapter 5
PRML Chapter 5PRML Chapter 5
PRML Chapter 5
Sunwoo Kim
 
Ann a Algorithms notes
Ann a Algorithms notesAnn a Algorithms notes
Ann a Algorithms notes
Prof. Neeta Awasthy
 
Chapter 18,19
Chapter 18,19Chapter 18,19
Chapter 18,19
heba_ahmad
 
Supervised and unsupervised learning
Supervised and unsupervised learningSupervised and unsupervised learning
Supervised and unsupervised learning
AmAn Singh
 

Similar to 15 anomaly detection (20)

Anomaly detection Full Article
Anomaly detection Full ArticleAnomaly detection Full Article
Anomaly detection Full Article
 
Monte Carlo Berkeley.pptx
Monte Carlo Berkeley.pptxMonte Carlo Berkeley.pptx
Monte Carlo Berkeley.pptx
 
Bootcamp of new world to taken seriously
Bootcamp of new world to taken seriouslyBootcamp of new world to taken seriously
Bootcamp of new world to taken seriously
 
Machine learning session4(linear regression)
Machine learning   session4(linear regression)Machine learning   session4(linear regression)
Machine learning session4(linear regression)
 
chap4_Parametric_Methods.ppt
chap4_Parametric_Methods.pptchap4_Parametric_Methods.ppt
chap4_Parametric_Methods.ppt
 
Prob and statistics models for outlier detection
Prob and statistics models for outlier detectionProb and statistics models for outlier detection
Prob and statistics models for outlier detection
 
Machine learning (5)
Machine learning (5)Machine learning (5)
Machine learning (5)
 
Aaa ped-16-Unsupervised Learning: clustering
Aaa ped-16-Unsupervised Learning: clusteringAaa ped-16-Unsupervised Learning: clustering
Aaa ped-16-Unsupervised Learning: clustering
 
2. diagnostics, collinearity, transformation, and missing data
2. diagnostics, collinearity, transformation, and missing data 2. diagnostics, collinearity, transformation, and missing data
2. diagnostics, collinearity, transformation, and missing data
 
CounterFactual Explanations.pdf
CounterFactual Explanations.pdfCounterFactual Explanations.pdf
CounterFactual Explanations.pdf
 
working with python
working with pythonworking with python
working with python
 
Estimating Causal Effects from Observations
Estimating Causal Effects from ObservationsEstimating Causal Effects from Observations
Estimating Causal Effects from Observations
 
MM - KBAC: Using mixed models to adjust for population structure in a rare-va...
MM - KBAC: Using mixed models to adjust for population structure in a rare-va...MM - KBAC: Using mixed models to adjust for population structure in a rare-va...
MM - KBAC: Using mixed models to adjust for population structure in a rare-va...
 
SVM - Functional Verification
SVM - Functional VerificationSVM - Functional Verification
SVM - Functional Verification
 
Machine learning introduction lecture notes
Machine learning introduction lecture notesMachine learning introduction lecture notes
Machine learning introduction lecture notes
 
Deep learning concepts
Deep learning conceptsDeep learning concepts
Deep learning concepts
 
PRML Chapter 5
PRML Chapter 5PRML Chapter 5
PRML Chapter 5
 
Ann a Algorithms notes
Ann a Algorithms notesAnn a Algorithms notes
Ann a Algorithms notes
 
Chapter 18,19
Chapter 18,19Chapter 18,19
Chapter 18,19
 
Supervised and unsupervised learning
Supervised and unsupervised learningSupervised and unsupervised learning
Supervised and unsupervised learning
 

Recently uploaded

Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 

Recently uploaded (20)

Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 

15 anomaly detection

  • 1. 15. Anomaly Detection ≫ PROBLEM MOTIVATION: Inputs: Test Data: Plot:
  • 2. Problem: we are given some training examples. We assume them to be NON-ANOMALOUS. So, we need to find if a new example is anomalous or not. We train a PROBABILITY MODEL: It divides the plot into various regions, such that each region corresponds to a level of provability. Centre → highest probability Outside → lowest P
  • 4. Examples: σ → controls the width and height of curve µ → mean of all values of x: controls the center.. Area below the curve is always = 1 So, the curve is either taller or wider.
  • 5. Estimation of µ and σ : ≫ ALGORITHM FOR ANOMALY DETECTION: Each feature can be individually distributred using Normal(Gaussian) distribution:
  • 6. P( x ) = product of probabilities of individual features Note: Steps of algorithm:
  • 8. P( x ) → height of curve == P(x1 ; µ1 , σ2 2) x P(x2 ; µ2 , σ2 2) For a new example:
  • 9. This means that anything below a particular height in the plot, given by ϵ : is an anomaly OR Anything outside the learned region is an anomaly: i.e., everything outside the magenta curve: ≫ DEVELOPING ANOMALY DETECTION SYSTEM: Anomaly detection system problem can be converted to a likes of Supervised Learning problem. Therefore:
  • 10. Thus we can take: Meaning all the training set examples are non-anomalous In Cross validation set and test set, we can have some examples of anomalous (y=1) and some of non-anomalous (y=0) type: Example:
  • 11. ≫ How to evaluate the algorithm: ≫ How to choose ϵ : We can choose the value of ϵ which gives the best value of F1 score. Anomaly detection vs Supervised Learning: In anomaly detection, it’s better to model anomalies based on negative examples, rather than positive examples… as future anomalies may be totally different.
  • 12. Applications of Anomaly detection vs Supervised Learning: Fraud detection can be a supervised learning application but only if there are a lot of people on the website who are doing fraudulent activity, i.e., most of the examples are positive, otherwise, it’s an anomaly detection problem only ≫ Choosing what features to use: We plot the data and the histogram looks like : We’d be happy to see this as this means that the feature x is a gaussian feature
  • 13. But: if the histogram looks like: This is a non gaussian distribution So, we use different transforms on our data to make it as close as possible to a gaussian distribution: ➔ These are feature v/s P( x ) We can use different transforms for different features to make them gaussian features: We may have to try out different transforms for the same feature to find the best (which gives the best gaussian look to the data).
  • 14. These parameters in the red are parameters we can vary to make the data look more and more Gaussian. ≫ Coming up with features: Error analysis method:
  • 15. If there is an anomalous example in middle of some non-anomalous examples, then the algo will fail. ➢So, we can look at that particular example and try to come up with a new feature that can tell what went wrong with that example Example:
  • 16. It may occur that if one of the computers is stuck in an infinite loop, the CPU load grows but the network traffic doesn’t: Then we can come up with a new feature: OR ≫ MULTIVARIATE GAUSSIAN DISTRIBUTION:
  • 17. Here, red points are training data Green point is our test data ➢Lets look at both features individually: The algo will not predict the right o/p … since the i/p data is distributed on the whole axis, so all the points have some probability of being correct.
  • 20. If we incr Σ : If we decr the variance of only one of the features: OR
  • 21. If we incr the variance of only one of the features: OR
  • 23. Varying the mean ( µ ): it moves the centre of contours, where the probability ( P( x ) ) is highest.
  • 24. ≫ Multivariate Gaussian Distribution Algorithm: Algorithm:
  • 25. ≫ Relationship of multivariate Gaussian Model with Original Gaussian Model: Original gaussian model is actually a special case of multivariate model, in which, the contours have their axes aligned with the features axes, i.e., the contours are not at nay angles: Original model is mathematically the multivariate model with a constraint, that is:
  • 26. ≫ WHEN TO USE ORIGINAL MODEL vs MULTIVARIATE MODEL: ➢In some cases, in original model, we may require to manually create extra features, so that the model can work fine. ➢In case of multivariate model, its important to get rid of redundant features, o/w the algo is very expensive, and Σ may even be non-invertible ………………………………………………………………………………………………………… …………………………………………………………………………………………………………