liveBook · Manning

Out-of-distribution

As explained in Outlier Detection in Python

Data containing observations whose distribution differs from the distribution represented by a model's training data.

An out-of-distribution (OOD) observation differs from the data represented during training. In image outlier detection, the term often means an object unlike those previously seen. A detector can flag such an object when a model trained on familiar objects would otherwise have to assign it an inappropriate familiar label. section 16.3

A useful distinction is between an unfamiliar type of record and an unusual instance of a familiar type. The former is often called a global or OOD outlier; the latter, a local or in-distribution outlier. These are practical categories, not a sharp boundary: real outliers can fall between them. section 2.7

Novel type or unusual instance?

Among images dominated by dogs, cats, and hamsters, a parrot is an OOD example. A dog photographed at an odd angle or in unusual lighting is instead an unusual instance of a familiar type. In transaction data dominated by purchases, sales, and payroll, a rare cash disbursement may be a global outlier, while an atypical purchase may be local. section 2.7

Figure 2.17 Point A is a local outlier and point B is a global outlier. Point A appears to be the same type of record as the cluster it is near but is distinct from it, while point B is not comparable to other points at all.

The diagram contrasts a point unusual within its nearby cluster with one unlike the other points overall. section 2.7

What counts as OOD depends on the comparison. Images from a different collection may differ enough to test for a distribution shift, but a shared label can complicate that assumption: if both collections contain the same bird species, those examples need not be treated as OOD. Even apparently distinct categories can be debatable. section 16.3 section 16.3.1

When data forms meaningful clusters, cluster-based detection offers one way to look for global outliers: records assigned to no cluster are flagged, while records near cluster edges may be local outliers. This is a conditional aid, not an OOD verdict. Clustering can be difficult, and many real datasets do not form clear clusters. In vision, the object matters more than an unusual property of the image itself; a flag calls for interpretation rather than automatic acceptance. section 3.2.3 section 16.3

How Outlier Detection in Python covers it

How deep it goes
Defines the distinction through global and local outliers and discusses image-testing assumptions, without specifying a dedicated OOD detector.
Examples
Contrasts a parrot with an unusually photographed dog, and compares bird images drawn from different collections.
What it assumes
Introduces the local-versus-global distinction through concrete examples while assuming a basic understanding of training data and outlier detection.
What you can do after
Evaluate/understand it by separating unfamiliar object types from unusual familiar instances and questioning whether a changed data source establishes OOD status.
How it connects
Connects OOD observations to global outliers, local outliers, in-distribution observations, and cluster-based outlier detection.

Also explained in

Compare how 2 books explain out-of-distribution →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Outlier Detection in Python. The section links point to the parts of the book it draws on.