SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Downloaden Sie, um offline zu lesen
July 21, 2020
Welcome To
Time Series Virtual Meetup
2
Agenda
●Introductions
●Our talk today
●Q&A
●Open Jobs
●Be a speaker
November 10 - 11, 2020
North America Virtual Experience
www.influxdays.com/virtual-experience-2020/
Call for Papers is now open!
We’re looking for great speakers – submit
your speaker application today.
Anomaly Detection with
Median Absolute Deviation
Anais Dotis-Georgiou
Developer Advocate | InfluxData
Median Absolute Deviation with Flux for Anomaly Detection
& Contributing Custom Flux Packages
Getting MAD
© 2020 InfluxData. All rights reserved.6
Hello!
• Developer Advocate
• Anais Jackie Dotis on LinkedIn
• @AnaisDotis
• http://community.influxdata.com/
© 2020 InfluxData. All rights reserved.7
What is Median Absolute Deviation?
• a “deviation from the pack” algorithms
• spot containers, virtual machines (VMs), servers, or sensors
that are behaving differently from others, you can use the
Median Absolute Deviation
• reduce incident times and MTTR to uphold SLAs
© 2020 InfluxData. All rights reserved.8
How Does MAD work?
© 2020 InfluxData. All rights reserved.9
Numerical Example of MAD
© 2020 InfluxData. All rights reserved.10
Step One
© 2020 InfluxData. All rights reserved.11
Step Two
© 2020 InfluxData. All rights reserved.12
Step Three
© 2020 InfluxData. All rights reserved.13
Step Four
© 2020 InfluxData. All rights reserved.14
Step Five
© 2020 InfluxData. All rights reserved.15
Flux Functions Used
• group()
• drop()
• median()
• map()
• join()
© 2020 InfluxData. All rights reserved.16
group()
The group() function groups records based on their values for
specific columns. It produces tables with new group keys based
on provided properties. Specify an empty array of columns to
ungroup data or merge all input tables into a single output table.
group(columns: ["host", "_measurement"], mode:"by")
© 2020 InfluxData. All rights reserved.17
drop()
The drop() function removes specified columns from a table.
Columns are specified either through a list or a predicate
function. When a dropped column is part of the group key, it will
be removed from the key. If a specified column is not present in a
table, it will return an error.
drop(columns: ["col1", "col2"])
© 2020 InfluxData. All rights reserved.18
median()
The median() function is a special application of the
quantile() function that returns the median _value of an
input table or all non-null records in the input table with values
that fall within the 0.5 quantile (50th percentile) depending on
the method used.
median(
column: "_value",
method: "estimate_tdigest",
compression: 0.0
)
© 2020 InfluxData. All rights reserved.19
map()
The map() function applies a function to each record in the input tables. The modified
records are assigned to new tables based on the group key of the input table. The
output tables are the result of applying the map function to each record of the input
tables.
When the output record contains a different value for the group key, the record is
regrouped into the appropriate table. When the output record drops a column that
was part of the group key, that column is removed from the group key.
map(fn: (r) => ({ _value: r._value * r._value }))
© 2020 InfluxData. All rights reserved.20
join()
The join() function merges two or more input streams whose
values are equal on a set of common columns into a single
output stream. Null values are not considered equal when
comparing column values. The resulting schema is the union of
the input schemas. The resulting group key is the union of the
input group keys.
join(tables: {key1: table1, key2: table2}, on: ["_time", "_field"], method: "inner")
© 2020 InfluxData. All rights reserved.21
Custom Flux Function: Basic Syntax
// Basic function definition structure
functionName = (functionParameters) => functionOperations
// Function definition
square = (n) => n * n
// Function usage
> square(n:3)
9
© 2020 InfluxData. All rights reserved.22
Custom Flux Function: pipe-forward data
In the example below, the tables parameter is assigned to the <- expression,
which represents all data piped-forward into the function. tables is then
piped-forward into other operations in the function definition.
// Function usage
from(bucket: "example-bucket")
|> range(start: -1m)
|> filter(fn: (r) =>
r._measurement == "mem" and
r._field == "used_percent"
)
|> multByX(x:2.0)
functionName = (tables=<-) => tables |>
functionOperations
// Function definition
multByX = (tables=<-, x) =>
tables
|> map(fn: (r) => ({ r with _value:
r._value * x}))
© 2020 InfluxData. All rights reserved.23
Contributing a User Defined Flux Package
1. Write your function
2. Write a test
3. Compile
4. Submit a PR
© 2020 InfluxData. All rights reserved.24
mad.flux
package anomalydetection
import "math"
import "experimental"
mad = (table=<-, threshold=3.0) => {
// MEDiXi = med(x)
data = table |> group(columns: ["_time"], mode:"by")
med = data |> median(column: "_value")
// diff = |Xi - MEDiXi| = math.abs(xi-med(xi))
diff = join(tables: {data: data, med: med}, on: ["_time"],
method: "inner")
|> map(fn: (r) => ({ r with _value: math.abs(x: r._value_data
- r._value_med) }))
|> drop(columns: ["_start", "_stop", "_value_med",
"_value_data"])
// The constant k is needed to make the estimator consistent
for the parameter of interest.
k = 1.4826
// MAD = k * MEDi * |Xi - MEDiXi|
diff_med =
diff
|> median(column: "_value")
|> map(fn: (r) => ({ r with MAD: k * r._value}))
|> filter(fn: (r) => r.MAD > 0.0)
output = join(tables: {diff: diff, diff_med: diff_med},
on: ["_time"], method: "inner")
|> map(fn: (r) => ({ r with _value:
r._value_diff/r._value_diff_med}))
|> map(fn: (r) => ({ r with
level:
if r._value >= threshold then "anomaly"
else "normal"
}))
return output
}
© 2020 InfluxData. All rights reserved.25
mad_test.flux
t_mad = (table=<-) =>
table
|> range(start:
2020-04-27T00:00:00Z, stop:
2020-05-01T00:00:00Z)
|> anomalydetection.mad(threshold:
3.0)
test t_mad = () =>
({input: testing.loadStorage(csv: inData),
want: testing.loadMem(csv: outData), fn:
t_mad})
package anomalydetection_test
import "testing"
import
"contrib/anaisdg/anomalydetection
"
inData= "<your annotated csv>"
outData="<your annotated csv>"
© 2020 InfluxData. All rights reserved.26
Compile Flux
1. Install the pkg-config utility:
brew install pkg-config
2. Install the pkg-config wrapper utility:
go get github.com/influxdata/pkg-config
3. Ensure the GOBIN directory is on your PATH:
export PATH=${GOPATH}/bin:${PATH}
4. Navigate to the Flux repository and run the following commands to build Flux:
go generate ./libflux/go/libflux
go generate ./stdlib
go build ./cmd/flux
Thank You
28
Open Jobs?
InfluxData: https://www.influxdata.com/careers/
29
NEXT MEETUP - August 12, 2020:
Obtaining the Perfect Smoke By Monitoring Your BBQ
with InfluxDB and Telegraf
Thanks for coming!

Weitere ähnliche Inhalte

Was ist angesagt?

John Melesky - Federating Queries Using Postgres FDW @ Postgres Open
John Melesky - Federating Queries Using Postgres FDW @ Postgres OpenJohn Melesky - Federating Queries Using Postgres FDW @ Postgres Open
John Melesky - Federating Queries Using Postgres FDW @ Postgres Open
PostgresOpen
 

Was ist angesagt? (20)

Java 8 monads
Java 8   monadsJava 8   monads
Java 8 monads
 
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseCodepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
 
Programming with Python and PostgreSQL
Programming with Python and PostgreSQLProgramming with Python and PostgreSQL
Programming with Python and PostgreSQL
 
ClickHouse Features for Advanced Users, by Aleksei Milovidov
ClickHouse Features for Advanced Users, by Aleksei MilovidovClickHouse Features for Advanced Users, by Aleksei Milovidov
ClickHouse Features for Advanced Users, by Aleksei Milovidov
 
Data visualization by Kenneth Odoh
Data visualization by Kenneth OdohData visualization by Kenneth Odoh
Data visualization by Kenneth Odoh
 
Engineering Fast Indexes for Big-Data Applications: Spark Summit East talk by...
Engineering Fast Indexes for Big-Data Applications: Spark Summit East talk by...Engineering Fast Indexes for Big-Data Applications: Spark Summit East talk by...
Engineering Fast Indexes for Big-Data Applications: Spark Summit East talk by...
 
Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013
 
Cubes - Lightweight Python OLAP (EuroPython 2012 talk)
Cubes - Lightweight Python OLAP (EuroPython 2012 talk)Cubes - Lightweight Python OLAP (EuroPython 2012 talk)
Cubes - Lightweight Python OLAP (EuroPython 2012 talk)
 
Map reduce: beyond word count
Map reduce: beyond word countMap reduce: beyond word count
Map reduce: beyond word count
 
John Melesky - Federating Queries Using Postgres FDW @ Postgres Open
John Melesky - Federating Queries Using Postgres FDW @ Postgres OpenJohn Melesky - Federating Queries Using Postgres FDW @ Postgres Open
John Melesky - Federating Queries Using Postgres FDW @ Postgres Open
 
Score (smart contract for icon)
Score (smart contract for icon) Score (smart contract for icon)
Score (smart contract for icon)
 
Dynamic C++ Silicon Valley Code Camp 2012
Dynamic C++ Silicon Valley Code Camp 2012Dynamic C++ Silicon Valley Code Camp 2012
Dynamic C++ Silicon Valley Code Camp 2012
 
Angular2 rxjs
Angular2 rxjsAngular2 rxjs
Angular2 rxjs
 
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Iterative Spark Developmen...
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Iterative Spark Developmen...Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Iterative Spark Developmen...
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Iterative Spark Developmen...
 
Reactive x
Reactive xReactive x
Reactive x
 
MariaDB and Clickhouse Percona Live 2019 talk
MariaDB and Clickhouse Percona Live 2019 talkMariaDB and Clickhouse Percona Live 2019 talk
MariaDB and Clickhouse Percona Live 2019 talk
 
Programmation fonctionnelle en JavaScript
Programmation fonctionnelle en JavaScriptProgrammation fonctionnelle en JavaScript
Programmation fonctionnelle en JavaScript
 
Psycopg2 - Connect to PostgreSQL using Python Script
Psycopg2 - Connect to PostgreSQL using Python ScriptPsycopg2 - Connect to PostgreSQL using Python Script
Psycopg2 - Connect to PostgreSQL using Python Script
 
User Defined Aggregation in Apache Spark: A Love Story
User Defined Aggregation in Apache Spark: A Love StoryUser Defined Aggregation in Apache Spark: A Love Story
User Defined Aggregation in Apache Spark: A Love Story
 
Obtaining the Perfect Smoke By Monitoring Your BBQ with InfluxDB and Telegraf
Obtaining the Perfect Smoke By Monitoring Your BBQ with InfluxDB and TelegrafObtaining the Perfect Smoke By Monitoring Your BBQ with InfluxDB and Telegraf
Obtaining the Perfect Smoke By Monitoring Your BBQ with InfluxDB and Telegraf
 

Ähnlich wie Time Series Meetup: Virtual Edition | July 2020

New Directions in Mahout's Recommenders
New Directions in Mahout's RecommendersNew Directions in Mahout's Recommenders
New Directions in Mahout's Recommenders
sscdotopen
 

Ähnlich wie Time Series Meetup: Virtual Edition | July 2020 (20)

Stratosphere Intro (Java and Scala Interface)
Stratosphere Intro (Java and Scala Interface)Stratosphere Intro (Java and Scala Interface)
Stratosphere Intro (Java and Scala Interface)
 
DASH: A C++ PGAS Library for Distributed Data Structures and Parallel Algorit...
DASH: A C++ PGAS Library for Distributed Data Structures and Parallel Algorit...DASH: A C++ PGAS Library for Distributed Data Structures and Parallel Algorit...
DASH: A C++ PGAS Library for Distributed Data Structures and Parallel Algorit...
 
Performing Data Science with HBase
Performing Data Science with HBasePerforming Data Science with HBase
Performing Data Science with HBase
 
A Deep Dive into Spark SQL's Catalyst Optimizer with Yin Huai
A Deep Dive into Spark SQL's Catalyst Optimizer with Yin HuaiA Deep Dive into Spark SQL's Catalyst Optimizer with Yin Huai
A Deep Dive into Spark SQL's Catalyst Optimizer with Yin Huai
 
Dax en
Dax enDax en
Dax en
 
Spark Summit EU 2015: Spark DataFrames: Simple and Fast Analysis of Structure...
Spark Summit EU 2015: Spark DataFrames: Simple and Fast Analysis of Structure...Spark Summit EU 2015: Spark DataFrames: Simple and Fast Analysis of Structure...
Spark Summit EU 2015: Spark DataFrames: Simple and Fast Analysis of Structure...
 
Mapredtutorial
MapredtutorialMapredtutorial
Mapredtutorial
 
Computer Science CS Project Matrix CBSE Class 12th XII .pdf
Computer Science CS Project Matrix CBSE Class 12th XII .pdfComputer Science CS Project Matrix CBSE Class 12th XII .pdf
Computer Science CS Project Matrix CBSE Class 12th XII .pdf
 
Introduction to DAX Language
Introduction to DAX LanguageIntroduction to DAX Language
Introduction to DAX Language
 
Automatic Task-based Code Generation for High Performance DSEL
Automatic Task-based Code Generation for High Performance DSELAutomatic Task-based Code Generation for High Performance DSEL
Automatic Task-based Code Generation for High Performance DSEL
 
R studio
R studio R studio
R studio
 
Mapfilterreducepresentation
MapfilterreducepresentationMapfilterreducepresentation
Mapfilterreducepresentation
 
Stata cheat sheet: data processing
Stata cheat sheet: data processingStata cheat sheet: data processing
Stata cheat sheet: data processing
 
Transformations and actions a visual guide training
Transformations and actions a visual guide trainingTransformations and actions a visual guide training
Transformations and actions a visual guide training
 
PyCon SG x Jublia - Building a simple-to-use Database Management tool
PyCon SG x Jublia - Building a simple-to-use Database Management toolPyCon SG x Jublia - Building a simple-to-use Database Management tool
PyCon SG x Jublia - Building a simple-to-use Database Management tool
 
New Directions in Mahout's Recommenders
New Directions in Mahout's RecommendersNew Directions in Mahout's Recommenders
New Directions in Mahout's Recommenders
 
Stata Cheat Sheets (all)
Stata Cheat Sheets (all)Stata Cheat Sheets (all)
Stata Cheat Sheets (all)
 
Deep Dive on ClickHouse Sharding and Replication-2202-09-22.pdf
Deep Dive on ClickHouse Sharding and Replication-2202-09-22.pdfDeep Dive on ClickHouse Sharding and Replication-2202-09-22.pdf
Deep Dive on ClickHouse Sharding and Replication-2202-09-22.pdf
 
How to become an Android dev starting from iOS (and vice versa)
How to become an Android dev starting from iOS (and vice versa)How to become an Android dev starting from iOS (and vice versa)
How to become an Android dev starting from iOS (and vice versa)
 
Spark Sql and DataFrame
Spark Sql and DataFrameSpark Sql and DataFrame
Spark Sql and DataFrame
 

Mehr von InfluxData

How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
InfluxData
 
How Delft University's Engineering Students Make Their EV Formula-Style Race ...
How Delft University's Engineering Students Make Their EV Formula-Style Race ...How Delft University's Engineering Students Make Their EV Formula-Style Race ...
How Delft University's Engineering Students Make Their EV Formula-Style Race ...
InfluxData
 
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
InfluxData
 
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
InfluxData
 

Mehr von InfluxData (20)

Announcing InfluxDB Clustered
Announcing InfluxDB ClusteredAnnouncing InfluxDB Clustered
Announcing InfluxDB Clustered
 
Best Practices for Leveraging the Apache Arrow Ecosystem
Best Practices for Leveraging the Apache Arrow EcosystemBest Practices for Leveraging the Apache Arrow Ecosystem
Best Practices for Leveraging the Apache Arrow Ecosystem
 
How Bevi Uses InfluxDB and Grafana to Improve Predictive Maintenance and Redu...
How Bevi Uses InfluxDB and Grafana to Improve Predictive Maintenance and Redu...How Bevi Uses InfluxDB and Grafana to Improve Predictive Maintenance and Redu...
How Bevi Uses InfluxDB and Grafana to Improve Predictive Maintenance and Redu...
 
Power Your Predictive Analytics with InfluxDB
Power Your Predictive Analytics with InfluxDBPower Your Predictive Analytics with InfluxDB
Power Your Predictive Analytics with InfluxDB
 
How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
 
Build an Edge-to-Cloud Solution with the MING Stack
Build an Edge-to-Cloud Solution with the MING StackBuild an Edge-to-Cloud Solution with the MING Stack
Build an Edge-to-Cloud Solution with the MING Stack
 
Meet the Founders: An Open Discussion About Rewriting Using Rust
Meet the Founders: An Open Discussion About Rewriting Using RustMeet the Founders: An Open Discussion About Rewriting Using Rust
Meet the Founders: An Open Discussion About Rewriting Using Rust
 
Introducing InfluxDB Cloud Dedicated
Introducing InfluxDB Cloud DedicatedIntroducing InfluxDB Cloud Dedicated
Introducing InfluxDB Cloud Dedicated
 
Gain Better Observability with OpenTelemetry and InfluxDB
Gain Better Observability with OpenTelemetry and InfluxDB Gain Better Observability with OpenTelemetry and InfluxDB
Gain Better Observability with OpenTelemetry and InfluxDB
 
How a Heat Treating Plant Ensures Tight Process Control and Exceptional Quali...
How a Heat Treating Plant Ensures Tight Process Control and Exceptional Quali...How a Heat Treating Plant Ensures Tight Process Control and Exceptional Quali...
How a Heat Treating Plant Ensures Tight Process Control and Exceptional Quali...
 
How Delft University's Engineering Students Make Their EV Formula-Style Race ...
How Delft University's Engineering Students Make Their EV Formula-Style Race ...How Delft University's Engineering Students Make Their EV Formula-Style Race ...
How Delft University's Engineering Students Make Their EV Formula-Style Race ...
 
Introducing InfluxDB’s New Time Series Database Storage Engine
Introducing InfluxDB’s New Time Series Database Storage EngineIntroducing InfluxDB’s New Time Series Database Storage Engine
Introducing InfluxDB’s New Time Series Database Storage Engine
 
Start Automating InfluxDB Deployments at the Edge with balena
Start Automating InfluxDB Deployments at the Edge with balena Start Automating InfluxDB Deployments at the Edge with balena
Start Automating InfluxDB Deployments at the Edge with balena
 
Understanding InfluxDB’s New Storage Engine
Understanding InfluxDB’s New Storage EngineUnderstanding InfluxDB’s New Storage Engine
Understanding InfluxDB’s New Storage Engine
 
Streamline and Scale Out Data Pipelines with Kubernetes, Telegraf, and InfluxDB
Streamline and Scale Out Data Pipelines with Kubernetes, Telegraf, and InfluxDBStreamline and Scale Out Data Pipelines with Kubernetes, Telegraf, and InfluxDB
Streamline and Scale Out Data Pipelines with Kubernetes, Telegraf, and InfluxDB
 
Ward Bowman [PTC] | ThingWorx Long-Term Data Storage with InfluxDB | InfluxDa...
Ward Bowman [PTC] | ThingWorx Long-Term Data Storage with InfluxDB | InfluxDa...Ward Bowman [PTC] | ThingWorx Long-Term Data Storage with InfluxDB | InfluxDa...
Ward Bowman [PTC] | ThingWorx Long-Term Data Storage with InfluxDB | InfluxDa...
 
Scott Anderson [InfluxData] | New & Upcoming Flux Features | InfluxDays 2022
Scott Anderson [InfluxData] | New & Upcoming Flux Features | InfluxDays 2022Scott Anderson [InfluxData] | New & Upcoming Flux Features | InfluxDays 2022
Scott Anderson [InfluxData] | New & Upcoming Flux Features | InfluxDays 2022
 
Steinkamp, Clifford [InfluxData] | Closing Thoughts | InfluxDays 2022
Steinkamp, Clifford [InfluxData] | Closing Thoughts | InfluxDays 2022Steinkamp, Clifford [InfluxData] | Closing Thoughts | InfluxDays 2022
Steinkamp, Clifford [InfluxData] | Closing Thoughts | InfluxDays 2022
 
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
 
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Kürzlich hochgeladen (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 

Time Series Meetup: Virtual Edition | July 2020

  • 1. July 21, 2020 Welcome To Time Series Virtual Meetup
  • 3. November 10 - 11, 2020 North America Virtual Experience www.influxdays.com/virtual-experience-2020/ Call for Papers is now open! We’re looking for great speakers – submit your speaker application today.
  • 4. Anomaly Detection with Median Absolute Deviation Anais Dotis-Georgiou Developer Advocate | InfluxData
  • 5. Median Absolute Deviation with Flux for Anomaly Detection & Contributing Custom Flux Packages Getting MAD
  • 6. © 2020 InfluxData. All rights reserved.6 Hello! • Developer Advocate • Anais Jackie Dotis on LinkedIn • @AnaisDotis • http://community.influxdata.com/
  • 7. © 2020 InfluxData. All rights reserved.7 What is Median Absolute Deviation? • a “deviation from the pack” algorithms • spot containers, virtual machines (VMs), servers, or sensors that are behaving differently from others, you can use the Median Absolute Deviation • reduce incident times and MTTR to uphold SLAs
  • 8. © 2020 InfluxData. All rights reserved.8 How Does MAD work?
  • 9. © 2020 InfluxData. All rights reserved.9 Numerical Example of MAD
  • 10. © 2020 InfluxData. All rights reserved.10 Step One
  • 11. © 2020 InfluxData. All rights reserved.11 Step Two
  • 12. © 2020 InfluxData. All rights reserved.12 Step Three
  • 13. © 2020 InfluxData. All rights reserved.13 Step Four
  • 14. © 2020 InfluxData. All rights reserved.14 Step Five
  • 15. © 2020 InfluxData. All rights reserved.15 Flux Functions Used • group() • drop() • median() • map() • join()
  • 16. © 2020 InfluxData. All rights reserved.16 group() The group() function groups records based on their values for specific columns. It produces tables with new group keys based on provided properties. Specify an empty array of columns to ungroup data or merge all input tables into a single output table. group(columns: ["host", "_measurement"], mode:"by")
  • 17. © 2020 InfluxData. All rights reserved.17 drop() The drop() function removes specified columns from a table. Columns are specified either through a list or a predicate function. When a dropped column is part of the group key, it will be removed from the key. If a specified column is not present in a table, it will return an error. drop(columns: ["col1", "col2"])
  • 18. © 2020 InfluxData. All rights reserved.18 median() The median() function is a special application of the quantile() function that returns the median _value of an input table or all non-null records in the input table with values that fall within the 0.5 quantile (50th percentile) depending on the method used. median( column: "_value", method: "estimate_tdigest", compression: 0.0 )
  • 19. © 2020 InfluxData. All rights reserved.19 map() The map() function applies a function to each record in the input tables. The modified records are assigned to new tables based on the group key of the input table. The output tables are the result of applying the map function to each record of the input tables. When the output record contains a different value for the group key, the record is regrouped into the appropriate table. When the output record drops a column that was part of the group key, that column is removed from the group key. map(fn: (r) => ({ _value: r._value * r._value }))
  • 20. © 2020 InfluxData. All rights reserved.20 join() The join() function merges two or more input streams whose values are equal on a set of common columns into a single output stream. Null values are not considered equal when comparing column values. The resulting schema is the union of the input schemas. The resulting group key is the union of the input group keys. join(tables: {key1: table1, key2: table2}, on: ["_time", "_field"], method: "inner")
  • 21. © 2020 InfluxData. All rights reserved.21 Custom Flux Function: Basic Syntax // Basic function definition structure functionName = (functionParameters) => functionOperations // Function definition square = (n) => n * n // Function usage > square(n:3) 9
  • 22. © 2020 InfluxData. All rights reserved.22 Custom Flux Function: pipe-forward data In the example below, the tables parameter is assigned to the <- expression, which represents all data piped-forward into the function. tables is then piped-forward into other operations in the function definition. // Function usage from(bucket: "example-bucket") |> range(start: -1m) |> filter(fn: (r) => r._measurement == "mem" and r._field == "used_percent" ) |> multByX(x:2.0) functionName = (tables=<-) => tables |> functionOperations // Function definition multByX = (tables=<-, x) => tables |> map(fn: (r) => ({ r with _value: r._value * x}))
  • 23. © 2020 InfluxData. All rights reserved.23 Contributing a User Defined Flux Package 1. Write your function 2. Write a test 3. Compile 4. Submit a PR
  • 24. © 2020 InfluxData. All rights reserved.24 mad.flux package anomalydetection import "math" import "experimental" mad = (table=<-, threshold=3.0) => { // MEDiXi = med(x) data = table |> group(columns: ["_time"], mode:"by") med = data |> median(column: "_value") // diff = |Xi - MEDiXi| = math.abs(xi-med(xi)) diff = join(tables: {data: data, med: med}, on: ["_time"], method: "inner") |> map(fn: (r) => ({ r with _value: math.abs(x: r._value_data - r._value_med) })) |> drop(columns: ["_start", "_stop", "_value_med", "_value_data"]) // The constant k is needed to make the estimator consistent for the parameter of interest. k = 1.4826 // MAD = k * MEDi * |Xi - MEDiXi| diff_med = diff |> median(column: "_value") |> map(fn: (r) => ({ r with MAD: k * r._value})) |> filter(fn: (r) => r.MAD > 0.0) output = join(tables: {diff: diff, diff_med: diff_med}, on: ["_time"], method: "inner") |> map(fn: (r) => ({ r with _value: r._value_diff/r._value_diff_med})) |> map(fn: (r) => ({ r with level: if r._value >= threshold then "anomaly" else "normal" })) return output }
  • 25. © 2020 InfluxData. All rights reserved.25 mad_test.flux t_mad = (table=<-) => table |> range(start: 2020-04-27T00:00:00Z, stop: 2020-05-01T00:00:00Z) |> anomalydetection.mad(threshold: 3.0) test t_mad = () => ({input: testing.loadStorage(csv: inData), want: testing.loadMem(csv: outData), fn: t_mad}) package anomalydetection_test import "testing" import "contrib/anaisdg/anomalydetection " inData= "<your annotated csv>" outData="<your annotated csv>"
  • 26. © 2020 InfluxData. All rights reserved.26 Compile Flux 1. Install the pkg-config utility: brew install pkg-config 2. Install the pkg-config wrapper utility: go get github.com/influxdata/pkg-config 3. Ensure the GOBIN directory is on your PATH: export PATH=${GOPATH}/bin:${PATH} 4. Navigate to the Flux repository and run the following commands to build Flux: go generate ./libflux/go/libflux go generate ./stdlib go build ./cmd/flux
  • 29. 29 NEXT MEETUP - August 12, 2020: Obtaining the Perfect Smoke By Monitoring Your BBQ with InfluxDB and Telegraf Thanks for coming!