Sign in to save

Bookmark this page so you can find it later.

Sign in to save

Bookmark this page so you can find it later.

Anomaly detection is a way for computers to find data points that do not fit the usual pattern. It matters because unusual data can signal important events, such as a broken sensor, a bank fraud attempt, a network attack, or a rare medical result. In AI and machine learning, anomaly detection helps people notice problems faster than they could by checking every data point by hand.

The main idea is simple: learn what normal looks like, then flag what seems surprisingly different.

A computer can detect anomalies by comparing new data to a model of normal behavior. Some methods use distance from a cluster, some use statistics such as the mean and standard deviation, and others use machine learning models trained on large data sets. A point may be labeled unusual if it is far from most other points or if its value is very unlikely based on past data.

Anomaly detection does not prove that something bad happened, but it tells humans where to look more closely.

Key Facts

  • An anomaly is a data point or event that is very different from the normal pattern.
  • A simple rule is to flag values with z = (x - mean) / standard deviation when |z| is large.
  • In many school examples, values more than 2 or 3 standard deviations from the mean are treated as possible anomalies.
  • Distance-based methods flag points that are far from their nearest neighbors or far from the center of a cluster.
  • Supervised anomaly detection uses labeled examples, while unsupervised anomaly detection looks for unusual patterns without labels.
  • An anomaly alert means investigate, not automatically guilty, broken, or dangerous.

Vocabulary

Anomaly
An anomaly is a data point, event, or pattern that is unusually different from what is expected.
Machine Learning Model
A machine learning model is a computer system that learns patterns from data and uses them to make predictions or decisions.
Outlier
An outlier is a value that lies far away from most other values in a data set.
Threshold
A threshold is a cutoff value used to decide when a data point should be flagged.
False Positive
A false positive happens when a system flags something as an anomaly even though it is actually normal.

Common Mistakes to Avoid

  • Assuming every anomaly is an error is wrong because unusual data can be real and important, such as a record-breaking temperature or a rare medical result.
  • Using a threshold without checking the context is wrong because different systems have different normal ranges and different risks for false alarms.
  • Training only on messy or biased data is wrong because the model may learn the wrong version of normal and miss important anomalies.
  • Ignoring false positives is wrong because too many unnecessary alerts can make people stop trusting the system.

Practice Questions

  1. 1 A sensor normally reads a mean temperature of 20 degrees Celsius with a standard deviation of 2 degrees Celsius. A new reading is 27 degrees Celsius. Compute z = (x - mean) / standard deviation and decide whether it is a possible anomaly using a cutoff of |z| > 3.
  2. 2 A website usually gets 500 visits per hour with a standard deviation of 50 visits. One hour it gets 650 visits. Compute the z-score and decide whether it would be flagged using a cutoff of |z| > 2.
  3. 3 A school library uses anomaly detection to flag unusual book checkout patterns. Explain why the system should not automatically punish a student just because their activity is flagged as unusual.