SlideShare a Scribd company logo
1 of 48
Time Series Anomaly Detection
with .net and Azure
Marco Parenzan
Solution Sales Specialist @ Insight // Microsoft Azure MVP // 1nn0va Community Lead
Marco Parenzan
Platinum Sponsor
Gold Sponsor
Technical Sponsor
Marco Parenzan
Linkedin: https://www.linkedin.com/in/marcoparenzan/
Slideshare: https://www.slideshare.net/marco.parenzan
GitHub: https://github.com/marcoparenzan
Agenda
• Scenario
• Anomaly Detection in Time Series
• Data Science for the .NET developer
• How Data Scientists work
• Bring ML.NET to Azure
• Anomaly Detection As A Service in Azure
• Conclusions
Scenario
Scenario
From real industrial fridges 
In an industrial fridge, you monitor temperatures to check
not the temperature «per se», but to check the healthy of
the plant
• Opening a door
• Condenser
• Evaporator
You can considering each of these events as anomalies
that alter the temperature you measure in different part of
the fridge
Simple Cloud Architecture (Smart City*)
Storage
Account
IoT Hub
Devices
Events
Ingest
Current data analysis
Data collecting
Data Analysis
Data Report...?
«What happens in this scenario?»
What happens in production?
Efficiency Anomalies
Batch Streaming
Where we can evolve...
Storage
Account
Function App
IoT Hub
Devices
Events Notification
Logic App
Ingest Process
Anomaly Detection in Time Series
Anomaly Detection
Anomaly detection is the process of identifying unexpected items or events in data sets, which differ
from the norm.
And anomaly detection is often applied on unlabeled data which is known as unsupervised anomaly
detection.
Time Series
Definition
• Time series is a sequence of data points recorded in time order, often taken at successive
equally paced points in time.
Examples
• Stock prices, Sales demand, website traffic, daily temperatures, quarterly sales
Time series is different from regression analysis because of its time-dependent nature.
• Auto-correlation: Regression analysis requires that there is little or no autocorrelation in the data.
It occurs when the observations are not independent of each other. For example, in stock prices,
the current price is not independent of the previous price. [The observations have to be
dependent on time]
• Seasonality, a characteristic which we will discuss below.
Components of a Time Series
Trend
• is a general direction in which something is developing or changing. A trend can be upward(uptrend) or
downward(downtrend). It is not always necessary that the increase or decrease is consistently in the same direction in a
given period.
Seasonality
• Predictable pattern that recurs or repeats over regular intervals. Seasonality is often observed within a year or less.
Irregular fluctuation
• These are variations that occur due to sudden causes and are unpredictable. For example the rise in prices of food due
to war, flood, earthquakes, farmers striking etc.
Anomaly Detection in Time Series
In time series data, an anomaly or outlier can be termed as a data point which is not following the
common collective trend or seasonal or cyclic pattern of the entire data and is significantly distinct
from rest of the data. By significant, most data scientists mean statistical significance, which in order
words, signify that the statistical properties of the data point is not in alignment with the rest of the
series.
Anomaly detection has two basic assumptions:
• Anomalies only occur very rarely in the data.
• Their features differ from the normal instances significantly.
How to do Time Series Anomaly Detection?
Statistical Profiling Approach
• This can be done by calculating statistical values like mean or median moving average of the
historical data and using a standard deviation to come up with a band of statistical values which
can define the uppermost bound and the lower most bound and anything falling beyond these
ranges can be an anomaly.
• this approach is very handy and can always be the baseline approach, instead of going with any
sophisticated and complex methods which require a lot of fine tuning and may not be explainable.
• This is very effective for highly volatile time series as well, as most of the time series predictive
model algorithms fail when the data is highly volatile.
• But the main drawback of this approach is detecting the local outliers.
How to do Time Series Anomaly Detection?
By Predictive Confidence Level Approach
• One way of doing anomaly detection with time series data is by building a predictive model using
the historical data to estimate and get a sense of the overall common trend, seasonal or cyclic
pattern of the time series data.
• we can come up with a confidence interval, or a confidence band for the predicted values and
any actual data point which is falling beyond this confidence band is an anomaly
• The main advantage of this approach is finding local outlier but the main disadvantage is, this
approach highly depends on the efficiency of the predictive model. Any loop hole in the predictive
model can give false positives and false negatives.
How to do Time Series Anomaly Detection?
Clustering Based Unsupervised Approach
• Unsupervised approaches are extremely useful for anomaly detection as it does not require any
labelled data, mentioning that a particular data point is an anomaly.
Data Science for the .NET developer
Data Science and AI for the .NET developer
ML.NET is first and foremost a framework that you can use
to create your own custom ML models. This custom
approach contrasts with “pre-built AI,” where you use pre-
designed general AI services from the cloud (like many of
the offerings from Azure Cognitive Services). This can work
great for many scenarios, but it might not always fit your
specific business needs due to the nature of the machine
learning problem or to the deployment context (cloud vs. on-
premises).
ML.NET enables developers to use their existing .NET skills
to easily integrate machine learning into almost any .NET
application. This means that if C# (or F# or VB) is your
programming language of choice, you no longer have to
learn a new programming language, like Python or R, in
order to develop your own ML models and infuse custom
machine learning into your .NET apps.
ML.NET Components
Anomaly Detection
Classic Process
Helping no-data scientits developers (all! )
Unsupervised Machine LearningNo labelling
Auto(mated) MLfind the best tuning for you with parameters and algorithms
Automated Training Set for Anomaly Detection Algorithms
• the algorithms automatically generates a simulated training set based non your input data
https://docs.microsoft.com/en-us/azure/machine-learning/algorithm-cheat-sheet
Independent Identically Distributed (iid)
Data points collected in the time series are independently sampled from the same distribution
(independent identically distributed). Thus, the value at the current timestamp can be viewed as the
value at the next timestamp in expectation.
Singular Spectrum Analysis (SSA)
This class implements the general anomaly detection transform based on Singular Spectrum
Analysis (SSA). SSA is a powerful framework for decomposing the time-series into trend,
seasonality and noise components as well as forecasting the future values of the time-series.
In principle, SSA performs spectral analysis on the input time-series where each component in the
spectrum corresponds to a trend, seasonal or noise component in the time-series
Spectrum Residual Cnn (SrCnn)
to monitor the time-series continuously and alert for potential incidents on time
The algorithm first computes the Fourier Transform of the original data. Then it computes
the spectral residual of the log amplitude of the transformed signal before applying the Inverse
Fourier Transform to map the sequence back from the frequency to the time domain. This sequence
is called the saliency map. The anomaly score is then computed as the relative difference between
the saliency map values and their moving averages. If the score is above a threshold, the value at a
specific timestep is flagged as an outlier.
There are several parameters for SR algorithm. To obtain a model with good performance, we
suggest to tune windowSize and threshold at first, these are the most important parameters to SR.
Then you could search for an appropriate judgementWindowSize which is no larger than
windowSize. And for the remaining parameters, you could use the default value directly.
Time-Series Anomaly Detection Service at Microsof [https://arxiv.org/pdf/1906.03821.pdf]
Some tools required
.NET 5 + WPF + ML.NET
• Mandatory , the platform where we try to make experiments
Xplot.Ploty (soon you will understand I use this) https://fslab.org/XPlot/
• XPlot is a cross-platform data visualization package for the F# programming language powered by
popular JavaScript charting libraries Plotly and Google Charts. The library provides a complete
mapping for the configuration options of the underlying libraries and so you get a nice F# interface
that gives you access to the full power of Plotly and Google Charts. The XPlot library can be used
interactively from F# Interactive, but charts can equally easy be embedded in F# applications and in
HTML reports.
WebView2 https://docs.microsoft.com/en-us/microsoft-edge/webview2/gettingstarted/wpf
• The Microsoft Edge WebView2 control enables you to embed web technologies (HTML, CSS, and
JavaScript) in your native apps. The WebView2 control uses Microsoft Edge (Chromium) as the
rendering engine to display the web content in native apps. With WebView2, you may embed web
code in different parts of your native app. Build all of the native app within a single WebView instance.
Demo
Experimenting ML.NET with WPF
How Data Scientists work
Jupyter
Evolution and generalization of the seminal role of Mathematica
In web standards way
• Web (HTTP+Markdown)
• Python adoption (ipynb)
Written in Java
Python has an interop bridge...not native (if ever important)Python is a kernel for Jupyter
.NET Interactive and Jupyter
and Visual Studio Code
.NET Interactive gives C# and F# kernels to Jupyter
.NET Interactive gives all tools to create your hosting application independently from Jupyter
In Visual Studio Code, you have two different notebooks (looking similar but developed in parallel by
different teams)
.NET Interactive Notebook (by the .NET Interactive Team) that can run also Python
Jupyter Notebook (by the Azure Data Studio Team – probably) that can run also C# and F#
There is a little confusion on that 
.NET Interactive has a strong C#/F# Kernel...
...a less mature infrastructure (compared to Jupiter)
Demo
Experimenting ML.NET
with .NET Interactive
Bring ML.NET to Azure
.NET (5) hosting in Azure
Existing apps
.NET web apps (on-premises)
Cloud-Optimized
PaaS
Cloud-Native
PaaS for microservices and serverless
Monolithic / N-Tier
architectures
Monolithic / N-Tier
architectures
Microservices and serverless architectures
Cloud
Infrastructure-Ready
Monolithic / N-Tier
architectures
Relational
Database
VMs
Managed services
On-premises Azure
PaaS for containerized microservices
+ Serverless computing
+ Managed services
And Windows Containers
IaaS
(Infrastructure as a Service)
Azure Azure
Functions everywhere
Platform
App delivery
OS
On-premises
Code
App Service on Azure Stack
Windows
●●●
Non-Azure hosts
●●●
●●●
+
Azure Functions
host runtime
Azure Functions
Core Tools
Azure Functions
base Docker image
Azure Functions
.NET Docker image
Azure Functions
Node Docker image
●●●
Logic Apps
Visually design workflows in the cloud
Express logic through powerful control flow
Connect disparate functions and APIs
Utilize declarative definition to work with CI/CD
Demo
Bring ML.NET to Azure
Anomaly Detection As A Service in Azure
Azure Cognitive Services
Cognitive Services brings AI within reach of every developer—without requiring machine-learning
expertise. All it takes is an API call to embed the ability to see, hear, speak, search, understand, and
accelerate decision-making into your apps. Enable developers of all skill levels to easily add AI
capabilities to their apps.
Five areas:
• Decision
• Language
• Speech
• Vision
• Web search
Anomaly Detector
Identify potential problems early on.
Content Moderator
Detect potentially offensive or unwanted
content.
Metrics Advisor PREVIEW
Monitor metrics and diagnose issues.
Personalizer
Create rich, personalized experiences for
every user.
Anomaly Detector
Through an API, Anomaly Detector ingests time-series data of all types and selects the best-fitting
detection model for your data to ensure high accuracy. Customize the service to detect any level of
anomaly and deploy it where you need it most -- from the cloud to the intelligent edge with
containers. Azure is the only major cloud provider that offers anomaly detection as an AI service.
Demo
Anomaly Detection As A Service
Anomaly Detector
Through an API, Anomaly Detector ingests time-series data of all types and selects the best-fitting
detection model for your data to ensure high accuracy. Customize the service to detect any level of
anomaly and deploy it where you need it most -- from the cloud to the intelligent edge with
containers. Azure is the only major cloud provider that offers anomaly detection as an AI service.
It seems too much simple…
Business metrics
monitoring
AIOps Predictive maintenance
Metrics Advisor(preview)
REST APIs (SDKs)
Data ingestion, detection/alert
configuration, anomaly query
APIs
Web-based workspace
Model customization & incident
diagnostics
Collect time-series data Detect anomalies Send incident alerts Analyze root cause
Metrics Monitoring Pipeline
A simple light Time-Series Insights-like service
Conclusions
Conclusions
Start simple and bulk: you already have data
If you have daily data, you need to aggregate (a month?) to have training
• take time for a correct Data Lake strategy
• there is time for realtime
The right algorithm is the one that gives you what you want to see
• Also professionals make the same (besides REAL data scientists)
• But if you know statistics, if better for you 
Azure Cognitive Services will become more important
• New Metrics Advisor Service!
Platinum Sponsor
Gold Sponsor
Technical Sponsor

More Related Content

What's hot

ICTER 2014 Invited Talk: Large Scale Data Processing in the Real World: from ...
ICTER 2014 Invited Talk: Large Scale Data Processing in the Real World: from ...ICTER 2014 Invited Talk: Large Scale Data Processing in the Real World: from ...
ICTER 2014 Invited Talk: Large Scale Data Processing in the Real World: from ...
Srinath Perera
 
SparkApplicationDevMadeEasy_Spark_Summit_2015
SparkApplicationDevMadeEasy_Spark_Summit_2015SparkApplicationDevMadeEasy_Spark_Summit_2015
SparkApplicationDevMadeEasy_Spark_Summit_2015
Lance Co Ting Keh
 

What's hot (15)

Patterns of Streaming Applications
Patterns of Streaming ApplicationsPatterns of Streaming Applications
Patterns of Streaming Applications
 
Azure Digital Twins
Azure Digital TwinsAzure Digital Twins
Azure Digital Twins
 
Attacking Machine Learning used in AntiVirus with Reinforcement by Rubén Mart...
Attacking Machine Learning used in AntiVirus with Reinforcement by Rubén Mart...Attacking Machine Learning used in AntiVirus with Reinforcement by Rubén Mart...
Attacking Machine Learning used in AntiVirus with Reinforcement by Rubén Mart...
 
Sparking Science up with Research Recommendations by Maya Hristakeva
Sparking Science up with Research Recommendations by Maya HristakevaSparking Science up with Research Recommendations by Maya Hristakeva
Sparking Science up with Research Recommendations by Maya Hristakeva
 
Visualizing Model Selection with Scikit-Yellowbrick: An Introduction to Devel...
Visualizing Model Selection with Scikit-Yellowbrick: An Introduction to Devel...Visualizing Model Selection with Scikit-Yellowbrick: An Introduction to Devel...
Visualizing Model Selection with Scikit-Yellowbrick: An Introduction to Devel...
 
Strata 2014 Anomaly Detection
Strata 2014 Anomaly DetectionStrata 2014 Anomaly Detection
Strata 2014 Anomaly Detection
 
Experimental Design for Distributed Machine Learning with Myles Baker
Experimental Design for Distributed Machine Learning with Myles BakerExperimental Design for Distributed Machine Learning with Myles Baker
Experimental Design for Distributed Machine Learning with Myles Baker
 
ICTER 2014 Invited Talk: Large Scale Data Processing in the Real World: from ...
ICTER 2014 Invited Talk: Large Scale Data Processing in the Real World: from ...ICTER 2014 Invited Talk: Large Scale Data Processing in the Real World: from ...
ICTER 2014 Invited Talk: Large Scale Data Processing in the Real World: from ...
 
Live Anomaly Detection
Live Anomaly DetectionLive Anomaly Detection
Live Anomaly Detection
 
From Pipelines to Refineries: scaling big data applications with Tim Hunter
From Pipelines to Refineries: scaling big data applications with Tim HunterFrom Pipelines to Refineries: scaling big data applications with Tim Hunter
From Pipelines to Refineries: scaling big data applications with Tim Hunter
 
What the Bleep is Big Data? A Holistic View of Data and Algorithms
What the Bleep is Big Data? A Holistic View of Data and AlgorithmsWhat the Bleep is Big Data? A Holistic View of Data and Algorithms
What the Bleep is Big Data? A Holistic View of Data and Algorithms
 
Introduction to Analytics with Azure Notebooks and Python
Introduction to Analytics with Azure Notebooks and PythonIntroduction to Analytics with Azure Notebooks and Python
Introduction to Analytics with Azure Notebooks and Python
 
SparkApplicationDevMadeEasy_Spark_Summit_2015
SparkApplicationDevMadeEasy_Spark_Summit_2015SparkApplicationDevMadeEasy_Spark_Summit_2015
SparkApplicationDevMadeEasy_Spark_Summit_2015
 
Best Practices for Hyperparameter Tuning with MLflow
Best Practices for Hyperparameter Tuning with MLflowBest Practices for Hyperparameter Tuning with MLflow
Best Practices for Hyperparameter Tuning with MLflow
 
Using Deep Learning on Apache Spark to Diagnose Thoracic Pathology from Chest...
Using Deep Learning on Apache Spark to Diagnose Thoracic Pathology from Chest...Using Deep Learning on Apache Spark to Diagnose Thoracic Pathology from Chest...
Using Deep Learning on Apache Spark to Diagnose Thoracic Pathology from Chest...
 

Similar to Time Series Anomaly Detection with .net and Azure

Large Scale Automatic Forecasting for Millions of Forecasts
Large Scale Automatic Forecasting for Millions of ForecastsLarge Scale Automatic Forecasting for Millions of Forecasts
Large Scale Automatic Forecasting for Millions of Forecasts
Ajay Ohri
 
DMM9 - Data Migration Testing
DMM9 - Data Migration TestingDMM9 - Data Migration Testing
DMM9 - Data Migration Testing
Nick van Beest
 
Hadoop secondary sort and a custom comparator
Hadoop secondary sort and a custom comparatorHadoop secondary sort and a custom comparator
Hadoop secondary sort and a custom comparator
Subhas Kumar Ghosh
 
Comparing DOM XSS Tools On Real World Bug
Comparing DOM XSS Tools On Real World BugComparing DOM XSS Tools On Real World Bug
Comparing DOM XSS Tools On Real World Bug
Stefano Di Paola
 
ACM DEBS 2015: Realtime Streaming Analytics Patterns
ACM DEBS 2015: Realtime Streaming Analytics PatternsACM DEBS 2015: Realtime Streaming Analytics Patterns
ACM DEBS 2015: Realtime Streaming Analytics Patterns
Srinath Perera
 
Factory talk
Factory talkFactory talk
Factory talk
John H
 

Similar to Time Series Anomaly Detection with .net and Azure (20)

Time Series Anomaly Detection for .net and Azure
Time Series Anomaly Detection for .net and AzureTime Series Anomaly Detection for .net and Azure
Time Series Anomaly Detection for .net and Azure
 
Deep dive time series anomaly detection with different Azure Data Services
Deep dive time series anomaly detection with different Azure Data ServicesDeep dive time series anomaly detection with different Azure Data Services
Deep dive time series anomaly detection with different Azure Data Services
 
Deep Dive Time Series Anomaly Detection in Azure with dotnet
Deep Dive Time Series Anomaly Detection in Azure with dotnetDeep Dive Time Series Anomaly Detection in Azure with dotnet
Deep Dive Time Series Anomaly Detection in Azure with dotnet
 
Large Scale Automatic Forecasting for Millions of Forecasts
Large Scale Automatic Forecasting for Millions of ForecastsLarge Scale Automatic Forecasting for Millions of Forecasts
Large Scale Automatic Forecasting for Millions of Forecasts
 
Five Ways to Leverage AI and Tableau
Five Ways to Leverage AI and TableauFive Ways to Leverage AI and Tableau
Five Ways to Leverage AI and Tableau
 
DMM9 - Data Migration Testing
DMM9 - Data Migration TestingDMM9 - Data Migration Testing
DMM9 - Data Migration Testing
 
Predicting Stock Market Price Using Support Vector Regression
Predicting Stock Market Price Using Support Vector RegressionPredicting Stock Market Price Using Support Vector Regression
Predicting Stock Market Price Using Support Vector Regression
 
Hard Truths About Streaming and Eventing (Dan Rosanova, Microsoft) Kafka Summ...
Hard Truths About Streaming and Eventing (Dan Rosanova, Microsoft) Kafka Summ...Hard Truths About Streaming and Eventing (Dan Rosanova, Microsoft) Kafka Summ...
Hard Truths About Streaming and Eventing (Dan Rosanova, Microsoft) Kafka Summ...
 
Hadoop secondary sort and a custom comparator
Hadoop secondary sort and a custom comparatorHadoop secondary sort and a custom comparator
Hadoop secondary sort and a custom comparator
 
Comparing DOM XSS Tools On Real World Bug
Comparing DOM XSS Tools On Real World BugComparing DOM XSS Tools On Real World Bug
Comparing DOM XSS Tools On Real World Bug
 
Your data is in Prometheus, now what? (CurrencyFair Engineering Meetup, 2016)
Your data is in Prometheus, now what? (CurrencyFair Engineering Meetup, 2016)Your data is in Prometheus, now what? (CurrencyFair Engineering Meetup, 2016)
Your data is in Prometheus, now what? (CurrencyFair Engineering Meetup, 2016)
 
Smart E-Logistics for SCM Spend Analysis
Smart E-Logistics for SCM Spend AnalysisSmart E-Logistics for SCM Spend Analysis
Smart E-Logistics for SCM Spend Analysis
 
Training - What is Performance ?
Training  - What is Performance ?Training  - What is Performance ?
Training - What is Performance ?
 
1025 track1 Malin
1025 track1 Malin1025 track1 Malin
1025 track1 Malin
 
ACM DEBS 2015: Realtime Streaming Analytics Patterns
ACM DEBS 2015: Realtime Streaming Analytics PatternsACM DEBS 2015: Realtime Streaming Analytics Patterns
ACM DEBS 2015: Realtime Streaming Analytics Patterns
 
DEBS 2015 Tutorial : Patterns for Realtime Streaming Analytics
DEBS 2015 Tutorial : Patterns for Realtime Streaming AnalyticsDEBS 2015 Tutorial : Patterns for Realtime Streaming Analytics
DEBS 2015 Tutorial : Patterns for Realtime Streaming Analytics
 
Advanced Analytics using Apache Hive
Advanced Analytics using Apache HiveAdvanced Analytics using Apache Hive
Advanced Analytics using Apache Hive
 
Streamlio and IoT analytics with Apache Pulsar
Streamlio and IoT analytics with Apache PulsarStreamlio and IoT analytics with Apache Pulsar
Streamlio and IoT analytics with Apache Pulsar
 
Discovering signal in financial time series- where and how to start
Discovering signal in financial time series- where and how to startDiscovering signal in financial time series- where and how to start
Discovering signal in financial time series- where and how to start
 
Factory talk
Factory talkFactory talk
Factory talk
 

More from Marco Parenzan

More from Marco Parenzan (20)

Azure IoT Central per lo SCADA engineer
Azure IoT Central per lo SCADA engineerAzure IoT Central per lo SCADA engineer
Azure IoT Central per lo SCADA engineer
 
Azure Hybrid @ Home
Azure Hybrid @ HomeAzure Hybrid @ Home
Azure Hybrid @ Home
 
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptxStatic abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
 
Azure Synapse Analytics for your IoT Solutions
Azure Synapse Analytics for your IoT SolutionsAzure Synapse Analytics for your IoT Solutions
Azure Synapse Analytics for your IoT Solutions
 
Power BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT Central Power BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT Central
 
Power BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT CentralPower BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT Central
 
Power BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT CentralPower BI Streaming Data Flow e Azure IoT Central
Power BI Streaming Data Flow e Azure IoT Central
 
Developing Actors in Azure with .net
Developing Actors in Azure with .netDeveloping Actors in Azure with .net
Developing Actors in Azure with .net
 
Math with .NET for you and Azure
Math with .NET for you and AzureMath with .NET for you and Azure
Math with .NET for you and Azure
 
Power BI data flow and Azure IoT Central
Power BI data flow and Azure IoT CentralPower BI data flow and Azure IoT Central
Power BI data flow and Azure IoT Central
 
.net for fun: write a Christmas videogame
.net for fun: write a Christmas videogame.net for fun: write a Christmas videogame
.net for fun: write a Christmas videogame
 
Building IoT infrastructure on edge with .net, Raspberry PI and ESP32 to conn...
Building IoT infrastructure on edge with .net, Raspberry PI and ESP32 to conn...Building IoT infrastructure on edge with .net, Raspberry PI and ESP32 to conn...
Building IoT infrastructure on edge with .net, Raspberry PI and ESP32 to conn...
 
Anomaly Detection with Azure and .NET
Anomaly Detection with Azure and .NETAnomaly Detection with Azure and .NET
Anomaly Detection with Azure and .NET
 
Deploy Microsoft Azure Data Solutions
Deploy Microsoft Azure Data SolutionsDeploy Microsoft Azure Data Solutions
Deploy Microsoft Azure Data Solutions
 
Azure IoT Central
Azure IoT CentralAzure IoT Central
Azure IoT Central
 
Anomaly Detection with Azure and .net
Anomaly Detection with Azure and .netAnomaly Detection with Azure and .net
Anomaly Detection with Azure and .net
 
Code Generation for Azure with .net
Code Generation for Azure with .netCode Generation for Azure with .net
Code Generation for Azure with .net
 
Running Kafka and Spark on Raspberry PI with Azure and some .net magic
Running Kafka and Spark on Raspberry PI with Azure and some .net magicRunning Kafka and Spark on Raspberry PI with Azure and some .net magic
Running Kafka and Spark on Raspberry PI with Azure and some .net magic
 
Time Series Anomaly Detection with Azure and .NETT
Time Series Anomaly Detection with Azure and .NETTTime Series Anomaly Detection with Azure and .NETT
Time Series Anomaly Detection with Azure and .NETT
 
Code Generation for Azure with .net
Code Generation for Azure with .netCode Generation for Azure with .net
Code Generation for Azure with .net
 

Recently uploaded

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 

Time Series Anomaly Detection with .net and Azure

  • 1. Time Series Anomaly Detection with .net and Azure Marco Parenzan Solution Sales Specialist @ Insight // Microsoft Azure MVP // 1nn0va Community Lead Marco Parenzan
  • 3. Marco Parenzan Linkedin: https://www.linkedin.com/in/marcoparenzan/ Slideshare: https://www.slideshare.net/marco.parenzan GitHub: https://github.com/marcoparenzan
  • 4. Agenda • Scenario • Anomaly Detection in Time Series • Data Science for the .NET developer • How Data Scientists work • Bring ML.NET to Azure • Anomaly Detection As A Service in Azure • Conclusions
  • 6. Scenario From real industrial fridges  In an industrial fridge, you monitor temperatures to check not the temperature «per se», but to check the healthy of the plant • Opening a door • Condenser • Evaporator You can considering each of these events as anomalies that alter the temperature you measure in different part of the fridge
  • 7. Simple Cloud Architecture (Smart City*) Storage Account IoT Hub Devices Events Ingest
  • 8. Current data analysis Data collecting Data Analysis Data Report...? «What happens in this scenario?»
  • 9. What happens in production? Efficiency Anomalies Batch Streaming
  • 10. Where we can evolve... Storage Account Function App IoT Hub Devices Events Notification Logic App Ingest Process
  • 11. Anomaly Detection in Time Series
  • 12. Anomaly Detection Anomaly detection is the process of identifying unexpected items or events in data sets, which differ from the norm. And anomaly detection is often applied on unlabeled data which is known as unsupervised anomaly detection.
  • 13. Time Series Definition • Time series is a sequence of data points recorded in time order, often taken at successive equally paced points in time. Examples • Stock prices, Sales demand, website traffic, daily temperatures, quarterly sales Time series is different from regression analysis because of its time-dependent nature. • Auto-correlation: Regression analysis requires that there is little or no autocorrelation in the data. It occurs when the observations are not independent of each other. For example, in stock prices, the current price is not independent of the previous price. [The observations have to be dependent on time] • Seasonality, a characteristic which we will discuss below.
  • 14. Components of a Time Series Trend • is a general direction in which something is developing or changing. A trend can be upward(uptrend) or downward(downtrend). It is not always necessary that the increase or decrease is consistently in the same direction in a given period. Seasonality • Predictable pattern that recurs or repeats over regular intervals. Seasonality is often observed within a year or less. Irregular fluctuation • These are variations that occur due to sudden causes and are unpredictable. For example the rise in prices of food due to war, flood, earthquakes, farmers striking etc.
  • 15. Anomaly Detection in Time Series In time series data, an anomaly or outlier can be termed as a data point which is not following the common collective trend or seasonal or cyclic pattern of the entire data and is significantly distinct from rest of the data. By significant, most data scientists mean statistical significance, which in order words, signify that the statistical properties of the data point is not in alignment with the rest of the series. Anomaly detection has two basic assumptions: • Anomalies only occur very rarely in the data. • Their features differ from the normal instances significantly.
  • 16. How to do Time Series Anomaly Detection? Statistical Profiling Approach • This can be done by calculating statistical values like mean or median moving average of the historical data and using a standard deviation to come up with a band of statistical values which can define the uppermost bound and the lower most bound and anything falling beyond these ranges can be an anomaly. • this approach is very handy and can always be the baseline approach, instead of going with any sophisticated and complex methods which require a lot of fine tuning and may not be explainable. • This is very effective for highly volatile time series as well, as most of the time series predictive model algorithms fail when the data is highly volatile. • But the main drawback of this approach is detecting the local outliers.
  • 17. How to do Time Series Anomaly Detection? By Predictive Confidence Level Approach • One way of doing anomaly detection with time series data is by building a predictive model using the historical data to estimate and get a sense of the overall common trend, seasonal or cyclic pattern of the time series data. • we can come up with a confidence interval, or a confidence band for the predicted values and any actual data point which is falling beyond this confidence band is an anomaly • The main advantage of this approach is finding local outlier but the main disadvantage is, this approach highly depends on the efficiency of the predictive model. Any loop hole in the predictive model can give false positives and false negatives.
  • 18. How to do Time Series Anomaly Detection? Clustering Based Unsupervised Approach • Unsupervised approaches are extremely useful for anomaly detection as it does not require any labelled data, mentioning that a particular data point is an anomaly.
  • 19. Data Science for the .NET developer
  • 20. Data Science and AI for the .NET developer ML.NET is first and foremost a framework that you can use to create your own custom ML models. This custom approach contrasts with “pre-built AI,” where you use pre- designed general AI services from the cloud (like many of the offerings from Azure Cognitive Services). This can work great for many scenarios, but it might not always fit your specific business needs due to the nature of the machine learning problem or to the deployment context (cloud vs. on- premises). ML.NET enables developers to use their existing .NET skills to easily integrate machine learning into almost any .NET application. This means that if C# (or F# or VB) is your programming language of choice, you no longer have to learn a new programming language, like Python or R, in order to develop your own ML models and infuse custom machine learning into your .NET apps.
  • 23. Helping no-data scientits developers (all! ) Unsupervised Machine LearningNo labelling Auto(mated) MLfind the best tuning for you with parameters and algorithms Automated Training Set for Anomaly Detection Algorithms • the algorithms automatically generates a simulated training set based non your input data https://docs.microsoft.com/en-us/azure/machine-learning/algorithm-cheat-sheet
  • 24. Independent Identically Distributed (iid) Data points collected in the time series are independently sampled from the same distribution (independent identically distributed). Thus, the value at the current timestamp can be viewed as the value at the next timestamp in expectation.
  • 25. Singular Spectrum Analysis (SSA) This class implements the general anomaly detection transform based on Singular Spectrum Analysis (SSA). SSA is a powerful framework for decomposing the time-series into trend, seasonality and noise components as well as forecasting the future values of the time-series. In principle, SSA performs spectral analysis on the input time-series where each component in the spectrum corresponds to a trend, seasonal or noise component in the time-series
  • 26. Spectrum Residual Cnn (SrCnn) to monitor the time-series continuously and alert for potential incidents on time The algorithm first computes the Fourier Transform of the original data. Then it computes the spectral residual of the log amplitude of the transformed signal before applying the Inverse Fourier Transform to map the sequence back from the frequency to the time domain. This sequence is called the saliency map. The anomaly score is then computed as the relative difference between the saliency map values and their moving averages. If the score is above a threshold, the value at a specific timestep is flagged as an outlier. There are several parameters for SR algorithm. To obtain a model with good performance, we suggest to tune windowSize and threshold at first, these are the most important parameters to SR. Then you could search for an appropriate judgementWindowSize which is no larger than windowSize. And for the remaining parameters, you could use the default value directly. Time-Series Anomaly Detection Service at Microsof [https://arxiv.org/pdf/1906.03821.pdf]
  • 27. Some tools required .NET 5 + WPF + ML.NET • Mandatory , the platform where we try to make experiments Xplot.Ploty (soon you will understand I use this) https://fslab.org/XPlot/ • XPlot is a cross-platform data visualization package for the F# programming language powered by popular JavaScript charting libraries Plotly and Google Charts. The library provides a complete mapping for the configuration options of the underlying libraries and so you get a nice F# interface that gives you access to the full power of Plotly and Google Charts. The XPlot library can be used interactively from F# Interactive, but charts can equally easy be embedded in F# applications and in HTML reports. WebView2 https://docs.microsoft.com/en-us/microsoft-edge/webview2/gettingstarted/wpf • The Microsoft Edge WebView2 control enables you to embed web technologies (HTML, CSS, and JavaScript) in your native apps. The WebView2 control uses Microsoft Edge (Chromium) as the rendering engine to display the web content in native apps. With WebView2, you may embed web code in different parts of your native app. Build all of the native app within a single WebView instance.
  • 30. Jupyter Evolution and generalization of the seminal role of Mathematica In web standards way • Web (HTTP+Markdown) • Python adoption (ipynb) Written in Java Python has an interop bridge...not native (if ever important)Python is a kernel for Jupyter
  • 31. .NET Interactive and Jupyter and Visual Studio Code .NET Interactive gives C# and F# kernels to Jupyter .NET Interactive gives all tools to create your hosting application independently from Jupyter In Visual Studio Code, you have two different notebooks (looking similar but developed in parallel by different teams) .NET Interactive Notebook (by the .NET Interactive Team) that can run also Python Jupyter Notebook (by the Azure Data Studio Team – probably) that can run also C# and F# There is a little confusion on that  .NET Interactive has a strong C#/F# Kernel... ...a less mature infrastructure (compared to Jupiter)
  • 34. .NET (5) hosting in Azure Existing apps .NET web apps (on-premises) Cloud-Optimized PaaS Cloud-Native PaaS for microservices and serverless Monolithic / N-Tier architectures Monolithic / N-Tier architectures Microservices and serverless architectures Cloud Infrastructure-Ready Monolithic / N-Tier architectures Relational Database VMs Managed services On-premises Azure PaaS for containerized microservices + Serverless computing + Managed services And Windows Containers IaaS (Infrastructure as a Service) Azure Azure
  • 35. Functions everywhere Platform App delivery OS On-premises Code App Service on Azure Stack Windows ●●● Non-Azure hosts ●●● ●●● + Azure Functions host runtime Azure Functions Core Tools Azure Functions base Docker image Azure Functions .NET Docker image Azure Functions Node Docker image ●●●
  • 36. Logic Apps Visually design workflows in the cloud Express logic through powerful control flow Connect disparate functions and APIs Utilize declarative definition to work with CI/CD
  • 38. Anomaly Detection As A Service in Azure
  • 39. Azure Cognitive Services Cognitive Services brings AI within reach of every developer—without requiring machine-learning expertise. All it takes is an API call to embed the ability to see, hear, speak, search, understand, and accelerate decision-making into your apps. Enable developers of all skill levels to easily add AI capabilities to their apps. Five areas: • Decision • Language • Speech • Vision • Web search Anomaly Detector Identify potential problems early on. Content Moderator Detect potentially offensive or unwanted content. Metrics Advisor PREVIEW Monitor metrics and diagnose issues. Personalizer Create rich, personalized experiences for every user.
  • 40. Anomaly Detector Through an API, Anomaly Detector ingests time-series data of all types and selects the best-fitting detection model for your data to ensure high accuracy. Customize the service to detect any level of anomaly and deploy it where you need it most -- from the cloud to the intelligent edge with containers. Azure is the only major cloud provider that offers anomaly detection as an AI service.
  • 42. Anomaly Detector Through an API, Anomaly Detector ingests time-series data of all types and selects the best-fitting detection model for your data to ensure high accuracy. Customize the service to detect any level of anomaly and deploy it where you need it most -- from the cloud to the intelligent edge with containers. Azure is the only major cloud provider that offers anomaly detection as an AI service. It seems too much simple…
  • 43. Business metrics monitoring AIOps Predictive maintenance Metrics Advisor(preview) REST APIs (SDKs) Data ingestion, detection/alert configuration, anomaly query APIs Web-based workspace Model customization & incident diagnostics
  • 44. Collect time-series data Detect anomalies Send incident alerts Analyze root cause Metrics Monitoring Pipeline A simple light Time-Series Insights-like service
  • 46. Conclusions Start simple and bulk: you already have data If you have daily data, you need to aggregate (a month?) to have training • take time for a correct Data Lake strategy • there is time for realtime The right algorithm is the one that gives you what you want to see • Also professionals make the same (besides REAL data scientists) • But if you know statistics, if better for you  Azure Cognitive Services will become more important • New Metrics Advisor Service!
  • 47.

Editor's Notes

  1. https://towardsdatascience.com/effective-approaches-for-time-series-anomaly-detection-9485b40077f1
  2. https://towardsdatascience.com/effective-approaches-for-time-series-anomaly-detection-9485b40077f1 https://towardsdatascience.com/anomaly-detection-for-dummies-15f148e559c1
  3. https://towardsdatascience.com/time-series-analysis-for-beginners-8a200552e332
  4. Anomaly detection is the process of identifying unexpected items or events in data sets, which differ from the norm. And anomaly detection is often applied on unlabeled data which is known as unsupervised anomaly detection. https://towardsdatascience.com/effective-approaches-for-time-series-anomaly-detection-9485b40077f1
  5. Effective Approaches for Time Series Anomaly Detection | by Aditya Bhattacharya | Towards Data Science
  6. https://towardsdatascience.com/effective-approaches-for-time-series-anomaly-detection-9485b40077f1
  7. https://towardsdatascience.com/effective-approaches-for-time-series-anomaly-detection-9485b40077f1
  8. SSA works by decomposing a time-series into a set of principal components. These components can be interpreted as the parts of a signal that correspond to trends, noise, seasonality, and many other factors. Then, these components are reconstructed and used to forecast values some time in the future.
  9. The Spectral Residual outlier detector is based on the paper Time-Series Anomaly Detection Service at Microsoft and is suitable for unsupervised online anomaly detection in univariate time series data. The algorithm first computes the Fourier Transform of the original data. Then it computes the spectral residual of the log amplitude of the transformed signal before applying the Inverse Fourier Transform to map the sequence back from the frequency to the time domain. This sequence is called the saliency map. The anomaly score is then computed as the relative difference between the saliency map values and their moving averages. If the score is above a threshold, the value at a specific timestep is flagged as an outlier. For more details, please check out the paper.
  10. What’s next? Modernize applications with .NET Core Today we focused on Cloud-optimized .NET Framework apps. However, many applications will benefit from modern architecture built on .NET Core – a much faster, modular, cross-platform, open source .NET. Websites can be modernized with ASP.NET Core to bring in better security, compliance, and much better performance than ASP.NET on .NET Framework. .NET Core also provides code patterns for building resilient, high-performance microservices on Linux and Windows.
  11. Build 2015
  12. Metrics Advisor, a new platform-as-a-service, provides you an out-of-the-box intelligent metrics monitoring platform. It simplifies the monitoring lifecycle with a built-in web-based workspace where you can setup time-series monitoring, alerting and diagnostics with a simple user interface. A rich set of REST APIs and SDK libraries support developers to build your custom solutions easily. Because Metrics Advisor has built an end-to-end monitoring pipeline, time to value is accelerated.
  13. The pipeline starts with abundant database connectors and pre-processing of your time-series data by cleaning, aggregating, and filling in gaps for a consistent time-series flow. Built on Cognitive Services Anomaly Detector, the core engine for time-series anomaly detection, Metrics Advisor looks at each data set and automatically selects the best algorithm from the model pool for high accuracy. Incidents trigger alerts through emails, webhooks, and Azure DevOps. With dimension tree and metrics graph, Metrics Advisor quickly shows you the key drivers of the problem. Metrics Advisor is intelligent, scalable, and can be implemented in a simple manner.