Basis Lab

Answers · How models work

How does DBSCAN decide that some points are noise and just leave them out?

In shortA point is left out when too few neighbours lie close to it and no dense point is close enough to attach it to a group.

DBSCAN leaves a point out when it fails the crowding test and is not close enough to any point that passes it. Both conditions use the same radius and count that define the groups, so noise is not a separate rule bolted on: it is the name for the part of the space where crowding never reaches.

∣{ j:d(xi,xj)≤ε }∣  ≥  m\lvert \{\, j : d(x_i, x_j) \le \varepsilon \,\} \rvert \;\ge\; m

The set being counted includes the point itself, because d(xi,xi)=0≤εd(x_i,x_i)=0\le\varepsilon. So m=4m=4 means the point plus three others within the radius, not four others. A point that passes is crowded. Crowded points within ε\varepsilon of each other are joined into one group. A point that fails the test is still not automatically noise: if it lies within ε\varepsilon of a crowded point, it is attached to that group as an edge member. It joins the group but does not extend it, so a sparse chain cannot drag two dense regions together. Noise is the remaining case: it fails the count and is within ε\varepsilon of no crowded point.

Read the table in order. The points at 0.2, 0.4 and 0.6 pass the count and are crowded; each lies within 0.5 of the next, so they form one group. The points at 0.0 and 0.8 fail the count, but 0.0 is 0.2 from the crowded point 0.2, and 0.8 is 0.2 from the crowded point 0.6, so both are edge members of the same group. The point at 2.0 is 1.2 from 0.8, 1.4 from 0.6 and 1.6 from 0.4, all greater than 0.5. It is not crowded and it is not within the radius of any crowded point, so it receives no group label. It is noise by the same two settings that made the group.

Why not assign every point

The natural guess is that a point failing the count is noise. That is false: the edge members above fail the count and are still in the group. The other natural guess is that every point must end up in some group, with unassigned points treated as a bug. That guess is the one the method is designed to reject. If a grouping insists on a home for every point, the isolated point at 2.0 must be attached to the group containing 0.0 to 0.8, or to whichever group is least wrong. Its distance from that group is at least 1.2, while the group's own points are within 0.5 of a crowded neighbour. Putting it in would widen the description of the group until the description described nothing. Leaving it unassigned keeps the group's boundary where the crowding actually stops.

The unassigned label is therefore information, not failure. A point can be an odd customer, a measurement error, a genuinely rare case, or the first sign that the radius is too small. The method does not decide which; it only reports that at this resolution the point is not part of any crowded region. That report is often the finding, particularly when the groups are background and the exceptions are what matters.

What changes the answer

Nothing here makes noise absolute. Change the radius or the count and the same point can move. With the six points above, take m=6m=6. The largest neighbourhood count is 5, at 0.4, so no point is crowded. With no crowded point there is nothing to attach an edge member to, and all six points are unassigned. At the other end, take ε=2.0\varepsilon=2.0 with m=4m=4. The point at 2.0 then has all six points within the radius, including itself, so its count is 6 and it passes. It is within the radius of the crowded point 0.4, so it joins the group. The same point is noise at radius 0.5 and a group member at radius 2.0.

That is why the radius has to be checked rather than trusted. A slightly small radius fragments a group and turns many of its points into unassigned ones. A slightly large radius lets separate groups join through thin bridges, and eventually every point passes. The count matters less, but it moves the same boundary: raising it makes crowding harder and leaves more points unassigned. In the example, raising it from 4 to 6 was enough to remove every crowded point. The useful check is stability: run two or three radii either side and keep the answer only if the grouping and the unassigned set do not change much. A radius on a plateau is a radius whose noise is meaningful.

Noise is not a post-processing step that deletes rows. The point remains in the data with no group label; whether to drop it, inspect it, or model it separately is a decision made after the grouping, not by the grouping. The method's contribution is to refuse to invent a group for it.

Worth keeping

  • A point is noise only if it fails the crowding test and lies outside the radius of every point that passes it.
  • A sparse point close to a crowded point is an edge member, not noise.
  • Changing the radius or the count can move a point between noise and an edge member, so noise is relative to those settings.

Where this goes next

This question is one step of Finding Structure Without Labels, a course that works through its subject from the beginning. The page that teaches this part of it is Groups That Are Not Blobs, and it reads the whole way through whether or not you have an account.

What an account changes is the practice: problems standing under every idea, marked with a reason rather than a tick, in a copy of the course that is yours.

Read that pageThe whole course

Other questions people ask about this

  1. How many principal components should I keep?There is no single correct number: keep the smallest number whose combined variation you can afford to lose, and report the share you discarded.
  2. Why does k-means split one long stretched-out group into two?Because k-means keeps only one centre per group, so a long group's ends end up closer to a second centre and the group is cut across its length.
  3. How can I tell whether my clusters are real or just something the algorithm made up?Check whether clusters survive refitting on different rows and whether they predict a held-out column; a convincing 2D plot is weak evidence because such plots can invent clusters.
  4. Why can't I just measure accuracy on data that has no labels?There is no accuracy to measure, because accuracy compares predictions with true answers and unlabelled data has none.
  5. Why does the model get stuck repeating the same sentence over and over?The model is not stuck in a memory loop: once it has written a phrase, that phrase is in its context and makes writing it again more likely, so a decoder that always picks the top word cannot leave.
  6. Why does diffusion add Gaussian noise instead of any random corruption?Diffusion adds Gaussian noise because Gaussian errors combine exactly: each step keeps the spread fixed and gives a closed-form noisy picture at any later step, which makes the reverse step learnable.

Read alongside