Skip to content
Français

Kinds of anomalies

  • Lesson 2
  • 30 min
  • Module 1: What "unusual" means

Where we are

We have seen one payment that a person spots at once. But not every unusual event is one strange value. Some are normal at noon and strange at 3 a.m., and some look normal one by one. In this lesson, we name the four kinds of anomaly and find one Larkfield example of each.

Plays from YouTube. Nothing loads from YouTube until you press play. Privacy
Lesson 2 of 38 · Anomaly Detection: Find What Is UnusualKinds of anomalies
Course overview

What you will be able to do

Name the kind of anomaly that you look for before you choose a method. A detector that checks one payment at a time cannot see an anomaly that exists only in a group, or only in a context.

Before you startWhat to know and to have readyAbout 30 minutes

What you need to know

  • What an anomaly is, the alert budget of 50 a day, and the cost of a miss and of a false alert, from The payment that did not fit.
  • How to read a line chart. Read distributions in Essential Mathematics and Statistics for AI shows the habit of reading the axes first.

What you need on your computer

Nothing. This lesson has no code.

A teacher looks at her class every morning. Here are four things that she could notice:

  1. One child is much taller than all the others. One value is far from the rest.
  2. One child wears a heavy winter coat. In January, that is normal. In July, it is strange. The coat is the same; the month makes it odd.
  3. Every child whispers the same word at the same moment. One whisper is normal. Thirty at once are not.
  4. From one Monday, the class is always a little noisier than before, and it stays that way. No single day is strange, but the normal level has moved.

These are the four kinds of anomaly of this course. Each one needs a different way of looking. If the teacher only checks each child one at a time, she sees the tall child. She never notices the whispering, because no single child does anything wrong.

In the last lesson, the stolen card of customer C-01234 was easy for a person to see. A program sees only what you ask it to compare. Look again at the eight payments in Portugal. Each one, alone, is a small amount, close to the customer’s usual baskets. As a group, eight payments in 7.4 minutes from a new country are clearly wrong.

So before you choose a method, ask: what is the unit that looks unusual? Is it one value, one value in its context, a group of values, or the level of a whole series? The answer decides what the detector must compare. Some methods cannot see some kinds at all.

Point anomalies: one value far from the rest

Section titled “Point anomalies: one value far from the rest”

A point anomaly is one value that is far from the other values. It is the tall child. It is the easiest kind to find, and most simple methods look for it.

Customer C-08459 is a personal customer. From July to November 2025, she made 17 honest payments between 19.18 and 116.52 dollars. Half of them were below 41.05 dollars: this middle value is called the median. Then, on 5 October 2025 at 13:24, one payment of 260.89 dollars arrived from Italy:

Her 17 honest payments The planted payment
Amount 19.18 to 116.52 dollars (median 41.05) 260.89 dollars
Times her median 0.5 to 2.8 6.4
Hour from 6:00 to 23:00 13:00

The payment is about 6.4 times her median. It is in the answer key as an account takeover: somebody got into her Larkfield account and paid with her saved card. The hour is ordinary, so the amount carries the signal. In the next module, you measure “how far from usual” with a number, for every payment.

Contextual anomalies: normal here, strange there

Section titled “Contextual anomalies: normal here, strange there”

A contextual anomaly is a value that is normal in one context and strange in another. It is the winter coat in July. Two kinds of information meet here. The context says where or when a value happens: the hour, the day, the customer, the region. The value is what you measure: an amount, a count, a latency.

Larkfield counts its card payments in each hour. At noon, the usual number is 132 payments. At 4 a.m., it is 11. These “usual” numbers are the medians of the same hour over all 183 days of payment data.

On 31 July 2025, between 4:00 and 5:00 in the morning, Larkfield received 59 payments. At noon, 59 payments would be a quiet hour: less than half the usual 132. At 4 a.m., 59 is more than five times the usual 11. The value 59 is not strange; 59 at 4 a.m. is.

The answer key explains it: 50 of those 59 payments were planted, and 47 of them were one card test. That leads to the third kind.

Collective anomalies: each one normal, the group strange

Section titled “Collective anomalies: each one normal, the group strange”

A collective anomaly is a group of events that is unusual together, while each event alone looks normal. It is the whole class whispering at once.

Thieves often buy lists of stolen card numbers. Before they spend big amounts, they test which cards still work, with tiny payments. This is called card testing.

On 18 October 2025, from 04:54 to 05:40, one device (D-606ea539) made 45 payments at Larkfield, from Japan. Each payment used a different customer’s card, and each one was between 1.02 and 4.89 dollars. Look at one payment alone. A 3-dollar payment is small, but honest customers also make small payments: Larkfield’s data has 719 honest payments of 5 dollars or less. Nothing about one payment says “card test”. The group does: one device, 45 cards, 46 minutes.

A detector that scores one payment at a time against its customer’s past sees 45 customers, each with one small, slightly odd payment. A detector that counts payments per device per hour sees the group at once.

Three small charts side by side. Point anomaly: one customer's 18 payments in time order, most between 19 and 117 dollars, and one dot high above them at 260.89 dollars. Contextual anomaly: a line of the usual number of payments for each hour of the day, low at night and high at noon and in the evening, and one dot at 4 a.m. with 59 payments, far above the line at that hour but below the line at noon. Collective anomaly: 45 dots between 1 and 5 dollars over 46 minutes, each one ordinary, with a bracket over the whole group.
The three kinds, with Larkfield data. Point: one value far from the rest. Contextual: 59 payments in an hour is quiet at noon and strange at 4 a.m. Collective: 45 tiny payments from one device, each on another customer's card.
Text description of the diagram

The picture has three small charts. The first is a point anomaly. It shows customer C-08459’s 18 payments in time order, on a y-axis from 0 to 300 dollars. Seventeen dots lie between 19 and 117 dollars. One dot stands high above them, at 260.89 dollars. The second is a contextual anomaly. A line shows the usual number of payments in each hour of the day, from 0 to 23. It is low at night (about 6 to 11 payments) and high at noon (132) and in the evening (139). One dot sits at 4 a.m. with 59 payments: far above the line at 4 a.m., but below the line at noon. A dashed line from the dot shows that 59 would be ordinary later in the day. The third is a collective anomaly. Forty-five dots between 1 and 5 dollars are spread over 46 minutes. No dot stands out. A bracket over all of them marks the group: one device, 45 cards.

The fourth kind is about time. A change point is a moment when the normal level of a series moves to a new level and stays there. It is the class that becomes noisier from one Monday. No single day looks strange, but after the change, every day is a little different from before.

Grace, Larkfield’s support lead, watches the refund rate: the share of orders that the help desk refunds. From 7 April 2025, Larkfield used a new delivery carrier, and more parcels arrived damaged. We planted this change: the refund rate rises by 0.3 percentage points and stays there. Measured on the data, the rate was 2.13% before 7 April 2025 and 2.43% after it.

  • Before the new carrier
  • From April 2025 (new carrier from 7 April)
Larkfield's monthly refund rate. Before April 2025, every month is between 1.98% and 2.28%. From May 2025, every month is between 2.30% and 2.54%. No single month is extreme; the level moved.
Text description of the chart

The chart shows the refund rate of each month from April 2024 to December 2025, on an axis from 1.5% to 3%. The first twelve months, April 2024 to March 2025, move up and down between 1.98% and 2.28%. April 2025, the month of the change, has 2.22%. From May 2025 to December 2025, every month is between 2.30% and 2.54%. The line does not jump on one month. It moves to a higher level and stays there.

Look at one month alone, for example June 2025 with 2.42%. It is high, but not shocking, and a detector of point anomalies may never fire on it. What changed is the level of the whole series. Module 3 teaches control charts, which were built for exactly this question. A small, lasting shift is hard to find, and the course measures how long each chart needs.

Not every change point is a problem. On 15 October 2025, Larkfield added payment to its app. Before, the app sent customers to the website to pay. In the following weeks, 60% of the customers started to pay in the app, on a phone that the shop had never seen for them. We planted this change too, as a normal one. The chart shows the share of each day’s payments made on a device that was new for that customer:

The share of payments on a device that is new for the customer. In the month before the app launch it was 3.89% on average; in the month after, 20.68%. Normal moved, and nothing is wrong.
Text description of the chart

The chart shows one value for each day from 1 July to 30 November 2025. The value is the share of payments made on a device that the customer had not used before. Until mid-October, the line stays low, mostly between 2% and 5%, with small bumps. From 15 October, the day of the app launch, it climbs within a week to between 20% and 30%. Then it falls slowly, to about 5% at the end of November, as the app phones become known devices. In the month before the launch, the average was 3.89%; in the month after, 20.68%.

For a fraud detector, “a new device” was a strong sign of a stolen card, as with customer C-01234. After the launch, thousands of honest customers have a new device. The share falls again later, because each app phone is new only once. But from then on, these customers pay on a different device than before. A detector that learned “new device means danger” now sends many false alerts. This is a change point too, but the right answer is not to alert. It is to learn the new normal. Module 9 shows what this does to a detection job, and how a drift check notices it.

Kind What is unusual Unit of the check Larkfield example
Point anomaly One value, far from the rest One payment 260.89 dollars from a customer with a median of 41.05
Contextual anomaly A value that is strange in its context One payment, hour or day, with its context 59 payments at 4 a.m. (usual 11)
Collective anomaly A group, while each member looks normal A device, a customer or a time window 45 cards on one device in 46 minutes
Change point The normal level of a series A series over time: a day, a week The refund rate: 2.13% → 2.43%

One real event can be several kinds at once. The eight payments in Portugal are a collective anomaly (eight in 7.4 minutes) and contextual too (2 a.m. for a Saturday-morning customer). This is fine. What matters is that some check can see the event, and that you know which one.

Ask about the cost before you build a detector for a kind. A point anomaly in Larkfield’s orders on Black Friday is real, but expected and harmless: do not alert on it. A change point in the refund rate costs money every day that nobody notices it, so it is worth a slower, careful check. A collective anomaly such as card testing comes before larger thefts. Finding it early is cheap, and missing it is expensive.

Guided practice: name the kind, the unit and the costs

Section titled “Guided practice: name the kind, the unit and the costs”

Here are six Larkfield questions. For each one, write three things: the kind of anomaly, the unit of the check, and what a miss and a false alert cost. Use the costs of the last lesson, and say “count it apart” when the cost has no money value.

  1. Read question 1 and its answer below, to see the format.
  2. For questions 2 to 6, write your three answers before you open the answers.
  3. Compare. If your unit is different, ask: could my check see this event at all?
  1. Sofia: “One customer pays from five countries in one hour.”
  2. Grace: “Agent A-17 refunds far more orders than the other agents, from one week on.”
  3. Amira: “The latency of ticket-api is 900 ms at 3 a.m., when hardly anybody uses it.”
  4. Sofia: “One device pays with 30 different customers’ cards in 20 minutes.”
  5. Mei, the data engineer: “The refunds feed sends zero refunds for a whole day.”
  6. Omar: “After the app launch, are customers paying in a new way?”
Show the answers
  1. Collective (each payment may look normal; five countries in an hour do not). Unit: one customer in a short time window. Miss: the stolen amounts plus 15 dollars each. False alert: 3 dollars of review. A blocked honest traveller is counted apart.
  2. Change point for that agent: from one week on, the level of the agent’s refund rate is higher and stays higher. Unit: one agent per day or week. Miss: wrong refunds every day until someone notices. False alert: Grace’s time, and an agent questioned for nothing (count it apart).
  3. Contextual. 900 ms might be normal at the busiest hour, but at 3 a.m. the service is quiet. Unit: one minute of the service, with the hour as context. Miss: a slow service that gets worse. False alert: Amira’s time at night.
  4. Collective: card testing. Unit: one device in a short time window. Miss: the tested cards are used for larger thefts later. False alert: 3 dollars of review.
  5. A point anomaly in the daily series (one day far below every other day). Unit: one day of the feed. It is a data fault, not a business event: a detector of refund problems would see a “very good day”. Miss: wrong reports and wrong charts. False alert: Mei’s time. In the course data, the feed sends zeros on 10 November 2025.
  6. A change point that is not a problem: normal moved. Unit: the share of payments on a new device, per day. The right action is to learn the new normal, not to alert every day.

Take question 4 and change one condition: the device pays with 30 cards in 20 days instead of 20 minutes. Is it still a collective anomaly? Which unit would see it, and what honest reason could explain it?

Show the answer

It can still be unusual, but a window of one hour now sees at most one or two payments. Nothing looks strange. To see it, the unit must be “one device over many days”, for example the number of different cards a device used in 30 days. An honest reason is possible: a shared family tablet, or a computer in an office where several people pay. A longer window collects more of these honest cases, so it gives more false alerts. Before you build this check, ask how many honest devices look like this.

Common mistake

A per-payment score misses the card test

Symptom: Tomás builds a score for each payment: how far its amount is from that customer’s own median. On account takeovers, it works well. On card testing, it finds almost nothing, and no error message says why.

Cause: the score checks one payment against one customer’s past. A card test is a collective anomaly. 45 customers each have one small payment. No single payment is far from its customer’s usual amount. In Module 2 you measure this. The per-customer score finds 53.4% of the account-takeover payments, but only 5.0% of the card-test payments. A rule that counts each device’s payments in the last hour finds 52.2% of the card-test payments. It finds 0% of the account takeovers. Both are measured in the evaluation months.

Fix: decide the kind first, then choose the unit. Use a per-payment score for point anomalies, and a count per device or per customer in a time window for collective ones. Most real systems combine several checks.

Consequence in AI work: a detector that is excellent on one kind of anomaly can be blind to another kind. If you report one overall number, the blind spot stays hidden. Rules, and when a rule is the right answer shows the recall for each kind of fraud, side by side.

Check your understanding

Give one Larkfield example of each kind of anomaly: point, contextual, collective and change point. For each one, name the unit of the check.

Show the answer
  • Point: customer C-08459’s payment of 260.89 dollars, against a median of 41.05. Unit: one payment.
  • Contextual: 59 payments between 4:00 and 5:00 on 31 July 2025, when that hour usually has 11 (and noon has 132). Unit: one hour, with the hour of the day as context.
  • Collective: 45 payments of 1.02 to 4.89 dollars, each on another customer’s card, from one device in 46 minutes (a card test). Unit: one device in a time window.
  • Change point: the refund rate rose from 2.13% to 2.43% after a new carrier started on 7 April 2025. Unit: the daily or monthly rate over time.

Check your understanding

Predict and explain: the app launch made the share of payments on a new device rise from 3.89% to 20.68%. A fraud detector that treats “new device” as a strong warning keeps running. What happens, and is the change point a problem?

Show the answer

The detector sends many more alerts, and almost all of the new ones are honest customers who started to use the app. The false alerts fill Sofia’s 50 slots and push real frauds out. The change point itself is not a problem: normal moved for a good reason. The right response is to notice the change and learn the new normal, for example by training again on recent data. Do not alert on every new device.

Check your understanding

Why can a detector that is very good at point anomalies still miss card testing?

Show the answer

Card testing is a collective anomaly. Each tiny payment is on a different customer’s card, so against each customer’s past it is only a little unusual. A score that checks one payment at a time never sees the group. In the course data, a per-customer amount score finds 5.0% of the card-test payments. A count of each device’s payments in the last hour finds 52.2% (both measured).

Recap

  • A point anomaly is one value far from the rest: 260.89 dollars from a customer whose median is 41.05.
  • A contextual anomaly is normal in one context and strange in another. 59 payments in an hour is quiet at noon (usual 132) and strange at 4 a.m. (usual 11).
  • A collective anomaly is a group that is strange while each member looks normal: 45 cards on one device in 46 minutes.
  • A change point is a lasting move of the normal level: the refund rate went from 2.13% to 2.43%. Some change points are good news, such as the app launch, and the right answer is to learn the new normal.
  • The kind decides the unit of the check, and a check with the wrong unit is blind to that kind.

You can now name what you look for and the unit that shows it. But to build a detector, you also need examples. How many payments do we know to be fraud, and how many do we know to be honest? Next, you see why the right answers are so rare here, and how that decides the method.

Next: Labels are rare, and that changes everything