Skip to main content

What is anomaly detection?

The AI Glossary

In our classes, we often pause to explain the ideas behind AI and the language used to describe it. These posts grew out of those conversations. They’re for anyone who would like to understand AI better, with no technical background assumed.

Anomaly detection means identifying observations that differ markedly from an expected pattern. An anomaly might be an unusually large transaction, a sudden change in a machine’s vibration or an unexpected gap in a stream of records. The term says that something is unusual, not that it is necessarily wrong or dangerous.

A simple approach sets a threshold: flag a value outside a specified range. More elaborate methods learn what combinations of measurements are common, then identify cases that do not resemble them. Some approaches use labeled examples of known problems. Others learn mainly from ordinary activity, which can be helpful when rare failures are poorly represented.

The reference point matters. A heart rate that is unusual for one person may be ordinary for another. A busy Monday may look abnormal against a weekend average. Contextual anomaly detection accounts for such circumstances; time-based methods may examine a sequence rather than one measurement.

Anomaly detection also involves a practical trade-off. A sensitive system may notice more genuine problems while producing more false alarms. A restrictive one may reduce interruptions but miss important changes. When the event of interest is rare, even a seemingly small false-alarm rate can generate many alerts that require investigation.

The baseline can change too. Software updates, new working hours or a different recording device may make yesterday’s reference less useful. A system should distinguish a change in the environment from a problem requiring action, although that distinction is often difficult.

In laboratory and imaging operations, a sudden drop in reported abnormal results from an external diagnostic center could signal a broken interface, a changed reporting code or a genuine shift in testing volume. The alert should direct someone to investigate; it should not invent an explanation. The same caution applies to wearable measurements. A change from a personal baseline may justify checking the device or seeking appropriate assessment, but anomaly detection alone does not establish a diagnosis or prove that a clinical event can be predicted.

Sources: scikit-learn — Novelty and Outlier Detection; scikit-learn — Cross-validation: Evaluating Estimator Performance

Further reading from Harvard Chan: Public Health Perspectives — To Meet Future Needs, Health Care Leaders Must Look at the Data (Science) (2022).

To learn more, take a look at the AI in Health Care Certificate of Specialization from the Advanced Learning Academy at Harvard T.H. Chan School of Public Health. You can take an individual course or work toward the full certificate.


I’m a doctor, not a statistician. I teach the AI in Health Care Certificate of Specialization with Dr. Heather Mattie, a statistician and co-director of Harvard Chan’s Health Data Science master’s program. For more on data science and statistics, see Harvard Chan’s Health Data Science resources.

AI is a fast-moving field. This explanation reflects our class discussions and related material at the time of writing. Terminology, capabilities and tools may change.

For suggested additions or corrections, please email me at tpanch@hsph.harvard.edu.

Dr. Trishan Panch
Program Director, AI in Health Care
Harvard T.H. Chan School of Public Health — Advanced Learning Academy

Lead with AI in Health Care

The AI Pragmatist is a monthly newsletter from ALA faculty, with new explainers & essays from the Advanced Learning Academy