How do you use a k-distance graph to select the eps parameter for DBSCAN?

Last updated 11 November 2026

  • Compute each point's distance to its k-th nearest neighbor (k = min_samples), sort ascending, and plot.

  • Set eps at the knee where the curve bends sharply up. Points left of it become core, points past it are noise.

  • Scale features first. Multiple knees signal varying densities, where OPTICS or HDBSCAN fit better.

  • https://medium.com/@tarammullin/dbscan-parameter-estimation-ff8330e3a3bd
  • https://www.analyticsvidhya.com/blog/2021/05/20-questions-to-test-your-skills-on-dbscan-clustering-algorithm/
  • https://mcpanalytics.ai/articles/dbscan-practical-guide-for-data-driven-decisions
All Clustering interview questions