Professional Documents
Culture Documents
Slide 11 - Anomaly Detection PDF
Slide 11 - Anomaly Detection PDF
detec-on(
Problem(
Text
Problem
Text
Text
mo-va-on(
Machine(Learning(
2
Anomaly(detec-on(example(
Aircra9(engine(features:( Dataset:(
(=(heat(generated( (
(=(vibra-on(intensity( New(engine:(
(((((…( (vibra-on)(
(heat)(
Andrew(Ng(
3
Density(es-ma-on(
Dataset:(
Is((((((((((((anomalous?(
Flag
anomaly
(vibra-on)(
anomaly
(heat)(
Andrew(Ng(
4
Anomaly(detec-on(example(
Fraud(detec-on:(
((((((((((((((=(features(of(user(((’s(ac-vi-es(
Model(((((((((from(data.(
Iden-fy(unusual(users(by(checking(which(have((
Manufacturing(
Monitoring(computers(in(a(data(center.(
(((((((=(features(of(machine((
(((((((=(memory(use,((((((((=(number(of(disk(accesses/sec,(
(((((((=(CPU(load,((((((((=(CPU(load/network(traffic.(
…(
(
Andrew(Ng(
Anomaly(
detec-on(
Gaussian(
distribu-on(
Machine(Learning(
6
Gaussian((Normal)(distribu-on(
Say((((((((((.(If((((is(a(distributed(Gaussian(with(mean((((,(variance((((((.(
Standard deviation
“distributed as”
Andrew(Ng(
7
Gaussian(distribu-on(example(
Andrew(Ng(
8
Parameter(es-ma-on(
Dataset:(
So if you're given a data set like
this, maybe the estimation of
what Gaussian distribution the
data came from might be The data has a very high probability of
roughly the Gaussian being in the central region, and a low
distribution with “u” being the probability of being further out, even
center of the distribution, though probability of being further out,
“sigma” standing for the and so on. So maybe this is a reasonable
deviation controlling the width estimate of “u” and “sigma squared”.
of this Gaussian distribution.
Seems like a reasonable fit to
the data.
Andrew(Ng(
Anomaly(
detec-on(
Algorithm(
Machine(Learning(
10
Anomaly(detec-on(algorithm(
1. Choose(features((((((that(you(think(might(be(indica-ve(of(
anomalous(examples.(
2. Fit(parameters(
(
(
(
(
3. Given(new(example((((,(compute(((((((((:((
(
(((((((Anomaly(if((
Andrew(Ng(
12
13
Plot of p(x)
14
Ok
Anomaly
15
Anomaly(detec-on(example(
High probability
The(importance(of(real?number(evalua-on(
When(developing(a(learning(algorithm((choosing(features,(etc.),(
making(decisions(is(much(easier(if(we(have(a(way(of(evalua-ng(
our(learning(algorithm.(
Assume(we(have(some(labeled(data,(of(anomalous(and(nonX
anomalous(examples.(((((((((((((((if(normal,(((((((((((((if(anomalous).(
Training(set: ( ( ((((((((assume(normal(examples/not(
anomalous)(
Cross(valida-on(set:(
Test(set:(
Andrew(Ng(
18
AircraA(engines(mo-va-ng(example(
10000((good((normal)(engines(
20( (flawed(engines((anomalous)(
Training(set:(6000(good(engines(
CV:(2000(good(engines((( ((),(10(anomalous((((((((((((()(
Test:(2000(good(engines(((((((((((((),(10(anomalous((((((((((((()(
Alterna-ve:(Less recommended. The same set of CV and Test is not a good ML practice
Training(set:(6000(good(engines(
CV:(4000(good(engines((( ((),(10(anomalous((((((((((((()(
Test:(4000(good(engines(((((((((((((),(10(anomalous((((((((((((()(
Andrew(Ng(
19
Algorithm(evalua-on(
Fit(model((((((((((on(training(set(
On(a(cross(valida-on/test(example(((((,(predict(
Possible(evalua-on(metrics:(
(X(True(posi-ve,(false(posi-ve,(false(nega-ve,(true(nega-ve(
(X(Precision/Recall( These would be ways to evaluate an anomaly detection
algorithm on your cross validation set or on your test set.
(X(F1Xscore(
Can(also(use(cross(valida-on(set(to(choose(parameter((
Andrew(Ng(
20
Try many different values of epsilon, and then pick the value of epsilon that, let's
say, maximizes f1-score, or that otherwise does well on your cross validation set.
Anomaly(
detec-on(
Anomaly(detec-on(
vs.(supervised(
learning(
Machine(Learning(
22
Andrew(Ng(
24
Non?gaussian(features(
37
30
Monitoring(computers(in(a(data(center(
Choose(features(that(might(take(on(unusually(large(or(
small(values(in(the(event(of(an(anomaly.(
(=(memory(use(of(computer(
(=(number(of(disk(accesses/sec(
(=(CPU(load(
(=(network(traffic(
(