Semi-supervised DBSCAN

Machine Learning
Introduced by
Ester, M. et al. (DBSCAN base); semi-supervised extensions by multiple authors (2000s–2010s)
Year
2000s
Type
Constrained density-based clustering
Family
Machine learning

What does it do?

Semi-supervised DBSCAN extends the density-based clustering algorithm DBSCAN (Ester et al., 1996) with a small set of user-supplied constraints: must-link pairs that should share a cluster, cannot-link pairs that should be separated, or labeled seed points.

The constraints steer cluster formation, while the method keeps DBSCAN's density-based definition of clusters and its explicit noise label. Published variants differ in how strictly they enforce the constraints.

The intuition behind the method

DBSCAN groups points that lie in dense regions separated by sparser gaps, but it has no way to take in domain knowledge such as 'these two records belong together' or 'these two must be kept apart'. The semi-supervised variants add this knowledge during cluster expansion. In the common formulation, a merge that would place a cannot-link pair in the same cluster is rejected, and must-link pairs are pulled into one cluster. The result is still a density-based partition, but one that is also consistent with the few known relationships. The constraints matter most when the unconstrained density structure disagrees with the categories the analyst cares about. When the two agree, they add little.

History

DBSCAN was introduced by Ester, Kriegel, Sander and Xu at KDD-96 in 1996. Constrained, semi-supervised variants of DBSCAN were developed later under several names, which are listed as aliases. These variants have no single originator and were proposed by several authors.

When to use it

Choose semi-supervised DBSCAN when most of the data is unlabeled, the clusters are expected to be non-convex or of differing density, noise is present, and a domain expert can supply a small number of pairwise constraints or seed labels. It suits spatial data and other settings where cluster shape is irregular and only part of the true structure is known. Do not use it when no constraints are available; plain DBSCAN applies in that case. If clusters are roughly spherical and many constraints exist, constrained k-means is simpler. Avoid the method on very high-dimensional data, where distance-based density estimates become unreliable, and when the constraints contradict the density structure.

Limitations and considerations

  • Results depend on epsilon and MinPts; the constraints do not remove the need to choose them.
  • Conflicting constraints, such as must-link pairs that span regions of very different density, can produce infeasible or degenerate clusters.
  • Neighborhood queries scale quadratically with the number of points unless spatial indexing is used, which limits use on very large datasets.
  • Distances lose contrast in high-dimensional spaces, so the density definition becomes unreliable there.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Can represent non-convex clusters that centroid-based methods such as k-means cannot represent, when those clusters are separated by density, with epsilon and MinPts chosen appropriately and the constraints consistent with the density structure.
  • Does not take the number of clusters as an input; the number of clusters follows from density and the constraints.
  • Points in low-density regions that no constraint links are labeled as noise rather than forced into a cluster.
  • A small number of constraints can move the partition toward expert categories without labeling the whole dataset.
  • Constraints are usually cheaper to obtain than full labels, because only pairs or seeds are needed.

Applications

  • Spatial clustering of GPS trajectories, where known origin-destination pairs are supplied as must-link constraints.
  • Customer segmentation in which a few labeled profiles indicate the segments the business wants recovered.
  • Grouping genes or cells using a partial set of known marker annotations.
  • Outlier-aware analysis in which noise points are candidates for fraud or fault investigation, while must-link pairs encode known legitimate groups.
  • Document clustering guided by a few known category memberships, leaving room for new topics to emerge.

How it works

How it works

1

Before clustering, the analyst supplies a small set of constraints: must-link pairs (two instances that should lie in the same cluster), cannot-link pairs (two instances that must be separated), or labeled seed points, which can be converted into such pairs. Because only a small part of the data needs annotation, the cost is usually well below that of labeling the whole dataset. The constraints should be checked for mutual consistency before the run.

2

Core points are identified with the standard DBSCAN rule: a point p is a core point when its epsilon-neighborhood, N_eps(p), contains at least MinPts points. Density-reachability and density-connectivity are then computed as in unconstrained DBSCAN.

Formula
N_{\varepsilon}(p) = \{q \in D : \text{dist}(p,q) \leq \varepsilon\}
3

During expansion, each candidate merge of two points or of two growing clusters is checked against the constraint set. In the common formulation, a merge that would place a cannot-link pair in the same cluster is rejected. A must-link pair whose points fall in different density-connected components either forces those components to merge or is reported as a conflict, depending on the variant. Because no single formulation is standard, the enforcement rules of the implementation used should be documented when results are reported.

4

Density-connected components that pass the constraint checks are grown iteratively from core points. In seeded variants, each labeled seed anchors its cluster: unlabeled points that are density-reachable from a seed are typically assigned to that seed's cluster, unless a cannot-link constraint prevents it. The published variants differ in how strongly seeds override the density structure, so the expansion rules should be stated alongside the results.

5

Points that are not density-reachable from any core point, and that no constraint forces into a cluster, are labeled noise, as in standard DBSCAN. Some variants treat must-link points that fall below the density threshold differently, so the noise labels should be checked against the implementation used.

Common pitfalls

  • Choosing epsilon without inspecting a k-nearest-neighbor distance plot, and then attributing poor results to the constraints.
  • Specifying must-link pairs that span regions of very different density, which forces merges or violates constraints.
  • Supplying so many constraints that the clustering is effectively supervised and the discovery aspect of the method is lost.
  • Clustering unscaled features, so that one attribute dominates the distances and therefore the neighborhoods.
  • Treating noise-labeled points as errors rather than as possible outliers worth examining.

Frequently asked questions

How many constraints do I need?

The method does not establish a minimum number. Constraints are typically sparse relative to all possible pairs, and it is advisable to check whether adding constraints still changes the result. The gain may level off well before full supervision is reached.

What if my constraints conflict with the density structure?

Conflicting constraints can produce infeasible merges or force unnatural clusters. Check the constraints for consistency before running the algorithm, and consider relaxing hard constraints to soft, penalty-weighted constraints if conflicts are frequent.

How do I choose epsilon and MinPts in the semi-supervised version?

Use the usual DBSCAN approach: plot k-nearest-neighbor distances, with k derived from MinPts, and look for an elbow. Constraints do not replace this tuning; choose epsilon and MinPts as you would for unconstrained DBSCAN.

When should I prefer constrained k-means over semi-supervised DBSCAN?

If clusters are roughly spherical, roughly equal in size, and you have many constraints, constrained k-means is simpler. Choose semi-supervised DBSCAN when cluster shapes are irregular, densities vary, or noise is expected.

Can I use labeled points instead of pairwise constraints?

Yes. Labeled seed points can be converted into must-link constraints (points with the same label must link) and cannot-link constraints (points with different labels must not link), and then passed to the constrained DBSCAN framework.

Related methods

Sources

  1. Ester, M., Kriegel, H.-P., Sander, J., & Xu, X. (1996). A density-based algorithm for discovering clusters in large spatial databases with noise. In Proceedings of the 2nd International Conference on Knowledge Discovery and Data Mining (KDD-96), pp. 226–231. AAAI Press.

    Open publication reference
  2. Zhu, X., & Goldberg, A. B. (2009). Introduction to Semi-Supervised Learning. Morgan & Claypool Publishers.

    ISBN: 978-1-59829-548-7