{"id":87081,"date":"2025-09-16T10:09:32","date_gmt":"2025-09-16T04:39:32","guid":{"rendered":"https:\/\/www.guvi.in\/blog\/?p=87081"},"modified":"2026-11-03T18:51:32","modified_gmt":"2026-11-03T13:21:32","slug":"what-is-dbscan-clustering-in-machine-learning","status":"publish","type":"post","link":"https:\/\/www.guvi.in\/blog\/what-is-dbscan-clustering-in-machine-learning\/","title":{"rendered":"What is DBSCAN Clustering in Machine Learning?"},"content":{"rendered":"\n<p>DBSCAN Clustering (Density-Based Spatial Clustering of Applications with Noise) is an unsupervised algorithm that groups points lying in densely packed regions and labels points in sparse regions as noise.<\/p>\n\n\n\n<p>It requires no preset number of clusters and can recover clusters of arbitrary shape, making it a common alternative to K-Means for irregular, noisy data.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>TL;DR Summary<\/strong><\/h2>\n\n\n\n<ul>\n<li>DBSCAN Clustering groups points by local density instead of distance to a centroid, determines the number of clusters by itself, and marks sparse points as noise.<\/li>\n\n\n\n<li>Two parameters control the result: <code>eps<\/code> (neighborhood radius) and <code>min_samples<\/code> (points required for a dense region). Features should be scaled first.<\/li>\n\n\n\n<li>It copes well with curved clusters and outliers, but it uses one global <code>eps<\/code>, so it handles clusters of different density and high-dimensional data poorly.<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What is DBSCAN Clustering?<\/strong><\/h2>\n\n\n\n<p>DBSCAN Clustering is a density-based method that defines a cluster as a maximal set of points connected through dense neighborhoods. <\/p>\n\n\n\n<p>A neighborhood is dense when it holds at least <code>min_samples<\/code> points within a radius of <code>eps<\/code>, and points that no dense neighborhood reaches are treated as noise.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Key Parameters<\/strong><\/h3>\n\n\n\n<p><strong>eps<\/strong> is the largest distance at which two points count as neighbors. The neighborhood of a point contains every point within <code>eps<\/code> of it, the point itself included. A value that is too small fragments clusters, and one that is too large merges them.<\/p>\n\n\n\n<p><strong>min_samples<\/strong> (called minPts in the original paper) is the number of points a neighborhood must contain for its center to qualify as a core point. scikit-learn counts the point itself. Higher values demand denser regions and produce more noise. The defaults are <code>eps=0.5<\/code> and <code>min_samples=5<\/code>.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong><em>DBSCAN is one of dozens of algorithms a working ML engineer must choose between. HCL GUVI\u2019s Intel &amp; IITM Pravartak Certified AI\/ML Course teaches that wider toolkit, from classical machine learning to deep learning and Generative AI, in live classes led by industry experts and Intel engineers, with no prior coding experience required!<\/em><\/strong><\/p>\n\n\n<div class=\"wp-block-guvi-cta-button\" style=\"justify-content:center;\"><a href=\"https:\/\/www.guvi.in\/mlp\/artificial-intelligence-and-machine-learning?utm_source=blog&#038;utm_medium=hyperlink&#038;utm_campaign=what-is-dbscan-clustering-in-machine-learning\" class=\"guvi-btn-enquire\" target=\"_blank\" rel=\"noopener noreferrer\">Enroll in HCL GUVI&#039;s AI\/ML Course<\/a><\/div>\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How DBSCAN Works<\/strong><\/h2>\n\n\n\n<p>Every point receives one of three roles:<\/p>\n\n\n\n<ul>\n<li><strong>Core point:<\/strong> at least <code>min_samples<\/code> points, itself included, lie within <code>eps<\/code>.<\/li>\n\n\n\n<li><strong>Border point:<\/strong> fewer than <code>min_samples<\/code> neighbors, but within <code>eps<\/code> of a core point.<\/li>\n\n\n\n<li><strong>Noise point:<\/strong> neither a core point nor a border point.<\/li>\n<\/ul>\n\n\n\n<p>The <a href=\"https:\/\/www.guvi.in\/blog\/what-is-an-algorithm\/\" target=\"_blank\" rel=\"noreferrer noopener\">algorithm<\/a> runs as follows:<\/p>\n\n\n\n<ol>\n<li>Select an unvisited point and find every point within <code>eps<\/code> of it.<\/li>\n\n\n\n<li>If the count is below <code>min_samples<\/code>, tentatively mark the point as noise and move on.<\/li>\n\n\n\n<li>Otherwise, start a new cluster containing the point and its neighbors.<\/li>\n\n\n\n<li>For each neighbor that is also a core point, add that neighbor&#8217;s own neighbors to the cluster. Continue until nothing more can be added.<\/li>\n\n\n\n<li>Pick the next unvisited point and repeat until all points have been visited.<\/li>\n<\/ol>\n\n\n\n<p>A point first marked as noise can later be claimed as a border point by a cluster that reaches it.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Density Reachability and Connectivity<\/strong><\/h2>\n\n\n\n<ul>\n<li><strong>Directly density-reachable:<\/strong> point q is directly density-reachable from p if q lies within <code>eps<\/code> of p and p is a core point.<\/li>\n\n\n\n<li><strong>Density-reachable:<\/strong> q is density-reachable from p if a chain of points leads from p to q, each directly density-reachable from the one before it.<\/li>\n\n\n\n<li><strong>Density-connected:<\/strong> p and q are density-connected if some point o exists from which both are density-reachable.<\/li>\n<\/ul>\n\n\n\n<p>A cluster is a maximal set of density-connected points. A border point cannot extend a chain, so reachability is asymmetric: a core point reaches a border point, but not the reverse. <\/p>\n\n\n\n<p>When a border point lies within <code>eps<\/code> of core points from two clusters, it joins whichever cluster reaches it first, so its assignment can depend on the row order of the data.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>DBSCAN Clustering Implementation in Python<\/strong><\/h2>\n\n\n\n<p>The code below, run with scikit-learn 1.9.1, generates 300 points in four blobs and compares three parameter settings.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import numpy as np\nimport matplotlib.pyplot as plt\nfrom sklearn.cluster import DBSCAN\nfrom sklearn.datasets import make_blobs\nfrom sklearn.metrics import silhouette_score, adjusted_rand_score\n\nX, y_true = make_blobs(n_samples=300, centers=4, cluster_std=0.50, random_state=42)\n\nsettings = {\"A\": (0.2, 5), \"B\": (0.5, 5), \"C\": (0.5, 15)}\nresults = {}\n\nfor name, (eps, min_samples) in settings.items():\n    labels = DBSCAN(eps=eps, min_samples=min_samples).fit_predict(X)\n    results&#91;name] = labels\n    n_clusters = len(set(labels)) - (1 if -1 in labels else 0)\n    n_noise = int(np.sum(labels == -1))\n    sil = silhouette_score(X, labels)\n    ari = adjusted_rand_score(y_true, labels)\n    print(f\"Case {name}: clusters={n_clusters}, noise={n_noise}, \"\n          f\"silhouette={sil:.2f}, ARI={ari:.2f}\")\n\nfig, axes = plt.subplots(1, 3, figsize=(15, 4))\nfor ax, (name, labels) in zip(axes, results.items()):\n    noise = labels == -1\n    ax.scatter(X&#91;~noise, 0], X&#91;~noise, 1], c=labels&#91;~noise], cmap=\"tab10\", s=18)\n    ax.scatter(X&#91;noise, 0], X&#91;noise, 1], c=\"black\", marker=\"x\", s=18)\n    ax.set_title(f\"Case {name}: eps={settings&#91;name]&#91;0]}, min_samples={settings&#91;name]&#91;1]}\")\nplt.show()<\/code><\/pre>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Case A: clusters=9, noise=126, silhouette=-0.11, ARI=0.22\nCase B: clusters=4, noise=7, silhouette=0.85, ARI=0.97\nCase C: clusters=4, noise=33, silhouette=0.71, ARI=0.84<\/code><\/pre>\n\n\n\n<p><strong>Case A <\/strong>uses an <code>eps<\/code> too small for this data, so the points split into nine fragments and 126 of 300 are labeled noise. <\/p>\n\n\n\n<p><strong>Case B<\/strong> recovers the four generating groups almost exactly. <\/p>\n\n\n\n<p><strong>Case C<\/strong> keeps the same <code>eps<\/code> but raises <code>min_samples<\/code> to 15, which leaves four clusters but moves 33 points into noise.<\/p>\n\n\n\n<p>Adjusted Rand Index (ARI) compares labels with known ground truth, so it applies only to labeled or synthetic data. <\/p>\n\n\n\n<p>The silhouette score above treats noise as one extra group and favors compact, convex clusters, so it is an unreliable judge of DBSCAN on curved shapes. Density-based validation (DBCV) suits unlabeled data better.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What the -1 Label Means<\/strong><\/h2>\n\n\n\n<p><code>DBSCAN.labels_<\/code> holds one integer per point. Values 0, 1, 2 and so on identify clusters, and -1 identifies noise. The value -1 is not a cluster and must be excluded from cluster counts. <\/p>\n\n\n\n<p>The indices of core points are stored in <code>core_sample_indices_<\/code>, and any labeled point outside that array is a border point. In Case B, 277 points are core, 16 are border, and 7 are noise.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Distance Metric and Feature Scaling<\/strong><\/h2>\n\n\n\n<p>Neighborhoods are measured with the <code>metric<\/code> parameter, which defaults to Euclidean. Because <code>eps<\/code> is one distance applied across all features, a feature measured in thousands will dominate one measured in decimals, so standardize features before <a href=\"https:\/\/www.guvi.in\/blog\/what-is-clustering-in-machine-learning\/\" target=\"_blank\" rel=\"noreferrer noopener\">clustering<\/a>. <\/p>\n\n\n\n<p>For latitude and longitude, use the haversine metric on coordinates converted to radians, and express <code>eps<\/code> in radians by dividing kilometers by 6371.0088, the mean Earth radius.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from sklearn.preprocessing import StandardScaler\n\nX_scaled = StandardScaler().fit_transform(X)\n\n# Geographic data: coordinates in degrees, neighborhood radius of 0.5 km\ncoords = np.radians(latlon_degrees)  # columns: latitude, longitude\ngeo = DBSCAN(eps=0.5 \/ 6371.0088, min_samples=10,\n             metric=\"haversine\", algorithm=\"ball_tree\").fit(coords)<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to Choose eps and min_samples<\/strong><\/h2>\n\n\n\n<p>Begin with <code>min_samples<\/code>. A common <a href=\"https:\/\/www.guvi.in\/blog\/heuristic-function-in-ai\/\" target=\"_blank\" rel=\"noreferrer noopener\">heuristic<\/a> is at least the number of features plus one, and often twice the number of features, which gives 4 for two-dimensional data. Then estimate <code>eps<\/code> with a k-distance graph:<\/p>\n\n\n\n<ol>\n<li>Set k equal to <code>min_samples<\/code>.<\/li>\n\n\n\n<li>Compute, for every point, the distance to its k-th nearest neighbor. The point itself is returned as its own first neighbor, matching how scikit-learn counts <code>min_samples<\/code>.<\/li>\n\n\n\n<li>Sort these distances in ascending order and plot them.<\/li>\n\n\n\n<li>Read <code>eps<\/code> from the elbow, where the curve turns sharply upward.<\/li>\n<\/ol>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from sklearn.neighbors import NearestNeighbors\n\nmin_samples = 5\ndistances, _ = NearestNeighbors(n_neighbors=min_samples).fit(X).kneighbors(X)\nk_distances = np.sort(distances&#91;:, -1])\n\nplt.plot(k_distances)\nplt.xlabel(\"Points sorted by distance\")\nplt.ylabel(\"Distance to neighbor 5 (point itself counted)\")\nplt.title(\"k-distance graph\")\nplt.show()<\/code><\/pre>\n\n\n\n<p>On the blob data, 90% of the points have a distance below about 0.47, after which the curve climbs to a maximum of 1.36. An <code>eps<\/code> near 0.5 is therefore a sensible choice.<\/p>\n\n\n\n<p>During tuning, one giant cluster means <code>eps<\/code> is too large, while mostly noise means <code>eps<\/code> is too small or <code>min_samples<\/code> too high.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><em><strong>Choosing <code>eps<\/code> and <code>min_samples<\/code> is learned by running the algorithm on messy datasets, not by reading about it. HCL GUVI\u2019s Intel &amp; IITM Pravartak Certified AI\/ML Course builds that experience through 20+ industry-grade projects and a capstone, with 1:1 doubt sessions with subject matter experts when a result looks wrong!<\/strong><\/em><\/p>\n\n\n<div class=\"wp-block-guvi-cta-button\" style=\"justify-content:center;\"><a href=\"https:\/\/www.guvi.in\/mlp\/artificial-intelligence-and-machine-learning?utm_source=blog&#038;utm_medium=hyperlink&#038;utm_campaign=what-is-dbscan-clustering-in-machine-learning\" class=\"guvi-btn-enquire\" target=\"_blank\" rel=\"noopener noreferrer\">Enroll in HCL GUVI&#039;s AI\/ML Course<\/a><\/div>\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>DBSCAN vs K-Means vs Hierarchical Clustering<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th><strong>Factor<\/strong><\/th><th><strong>K-Means<\/strong><\/th><th><strong>DBSCAN<\/strong><\/th><th><strong>Hierarchical<\/strong><\/th><\/tr><\/thead><tbody><tr><td><strong>Cluster definition<\/strong><\/td><td>Distance to a centroid<\/td><td>Connected dense regions<\/td><td>Nested merges shown as a dendrogram<\/td><\/tr><tr><td><strong>Number of clusters<\/strong><\/td><td>Chosen in advance<\/td><td>Found from <code>eps<\/code> and <code>min_samples<\/code><\/td><td>Chosen by cutting the dendrogram<\/td><\/tr><tr><td><strong>Cluster shape<\/strong><\/td><td>Roughly spherical, similar size<\/td><td>Arbitrary<\/td><td>Depends on the linkage method<\/td><\/tr><tr><td><strong>Outliers<\/strong><\/td><td>Assigned to a cluster and distort centroids<\/td><td>Labeled as noise<\/td><td>Assigned to a cluster<\/td><\/tr><tr><td><strong>Scalability<\/strong><\/td><td>Close to linear in the number of points<\/td><td>Near n log n with a spatial index, weaker in high dimensions<\/td><td>Quadratic time and memory or worse<\/td><\/tr><tr><td><strong>Typical use<\/strong><\/td><td>Customer segmentation, color quantization<\/td><td>Hotspot detection, anomaly detection<\/td><td>Taxonomies, small datasets<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>DBSCAN is the stronger choice when the cluster count is unknown, outliers are present, or clusters are curved. <a href=\"https:\/\/www.guvi.in\/blog\/k-means-clustering-algorithm-machine-learning\/\" target=\"_blank\" rel=\"noreferrer noopener\">K-Means<\/a> is the stronger choice for large, high-dimensional data with compact clusters of similar size. DBSCAN removes the need to choose k but introduces <code>eps<\/code> and <code>min_samples<\/code> in its place.<\/p>\n\n\n\n<p>It also does not handle clusters of different density. A single <code>eps<\/code> cannot suit a dense cluster and a sparse one at once, so the sparse cluster is either labeled noise or the dense clusters merge. OPTICS and HDBSCAN, covered below, address this.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>DBSCAN vs K-Means on Non-Spherical Data<\/strong><\/h2>\n\n\n\n<p>K-Means assigns each point to its nearest centroid, so its cluster boundaries are straight lines between centroids and cannot follow a crescent. The two-moons dataset shows the difference.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from sklearn.cluster import KMeans\nfrom sklearn.datasets import make_moons\n\nXm, ym = make_moons(n_samples=300, noise=0.06, random_state=42)\nkm_labels = KMeans(n_clusters=2, n_init=10, random_state=42).fit_predict(Xm)\ndb_labels = DBSCAN(eps=0.2, min_samples=5).fit_predict(Xm)\n\nprint(\"K-Means ARI:\", round(adjusted_rand_score(ym, km_labels), 2))\nprint(\"DBSCAN ARI:\", round(adjusted_rand_score(ym, db_labels), 2))<\/code><\/pre>\n\n\n\n<p>K-Means scores an ARI of 0.25, as it cuts across both moons. DBSCAN scores 1.00, recovering both shapes with no noise points.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>OPTICS and HDBSCAN<\/strong><\/h2>\n\n\n\n<p>Both algorithms extend DBSCAN to data with varying density, and both are in scikit-learn (OPTICS since version 0.21, HDBSCAN since 1.3). <\/p>\n\n\n\n<p>OPTICS orders points by reachability distance and produces a reachability plot from which clusters at different density levels can be extracted, so it needs no fixed <code>eps<\/code>. <\/p>\n\n\n\n<p>HDBSCAN builds a hierarchy across all <code>eps<\/code> values and keeps the clusters that persist the longest. Its main parameter is <code>min_cluster_size<\/code>, and it labels noise as -1. HDBSCAN is usually the first choice when densities differ, while OPTICS suits inspection through its reachability plot.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from sklearn.cluster import HDBSCAN\n\nlabels = HDBSCAN(min_cluster_size=10, copy=True).fit_predict(X)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Time Complexity<\/strong><\/h2>\n\n\n\n<p>The original paper reports an average of O(n log n). DBSCAN issues one neighborhood query per point, and a spatial index such as an R*-tree answers each query in O(log n). <\/p>\n\n\n\n<p>Without an index, or when the index loses its advantage in high dimensions, each query costs O(n) and the total becomes O(n\u00b2). <\/p>\n\n\n\n<p>Memory use can approach O(n\u00b2) when many points fall inside one another&#8217;s neighborhoods, because neighborhoods are stored.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Applications of DBSCAN Clustering<\/strong><\/h2>\n\n\n\n<ul>\n<li><strong>Anomaly detection:<\/strong> transactions, network flows and sensor readings that fit no dense pattern receive the label -1 and become candidates for review.<\/li>\n\n\n\n<li><strong>Geospatial hotspots:<\/strong> Huang et al. (2021) clustered about 200 GB of taxi GPS records from Huai&#8217;an, China, using DBSCAN+, a parallel DBSCAN variant with Eps of 30 m and MinPts of 3, to locate passenger hotspots at a scale that single-threaded DBSCAN could not handle (<a href=\"https:\/\/www.nature.com\/articles\/s41598-021-88822-3\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Scientific Reports 11, 9420<\/a>).<\/li>\n\n\n\n<li><strong>Medical image segmentation:<\/strong> Baselice et al. (2015) applied a modified DBSCAN to per-pixel proton density and relaxation-time estimates, instead of gray-level intensity, to segment and classify brain MR images. On a simulated case study it improved the correct classification rate over a Euclidean-distance approach (<a href=\"https:\/\/doi.org\/10.1109\/EMBC.2015.7319021\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">IEEE EMBC 2015, pages 2993 to 2996<\/a>).<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Limitations of DBSCAN Clustering<\/strong><\/h2>\n\n\n\n<ul>\n<li><strong>Parameter sensitivity:<\/strong> small changes in <code>eps<\/code> can split or merge clusters.<\/li>\n\n\n\n<li><strong>Varying density:<\/strong> one global <code>eps<\/code> cannot fit clusters of different density, which is the case HDBSCAN was designed for.<\/li>\n\n\n\n<li><strong>High dimensions:<\/strong> distances lose contrast as dimensions grow, so neighborhoods stop being informative. Reduce dimensionality with PCA or a similar method first.<\/li>\n\n\n\n<li><strong>No prediction step:<\/strong> DBSCAN has no <code>predict<\/code> method, so new points require a nearest-core-point rule or a refit.<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p><strong><em>A point joins a DBSCAN cluster only when enough neighbors support it, and a career in machine learning needs a similar base of connected skills. HCL GUVI\u2019s Intel &amp; IITM Pravartak Certified AI\/ML Course builds that base across Python, SQL, machine learning, deep learning and MLOps, with live classes, 20+ projects and placement guidance.<\/em><\/strong><\/p>\n\n\n<div class=\"wp-block-guvi-cta-button\" style=\"justify-content:center;\"><a href=\"https:\/\/www.guvi.in\/mlp\/artificial-intelligence-and-machine-learning?utm_source=blog&#038;utm_medium=hyperlink&#038;utm_campaign=what-is-dbscan-clustering-in-machine-learning\" class=\"guvi-btn-enquire\" target=\"_blank\" rel=\"noopener noreferrer\">Enroll in HCL GUVI&#039;s AI\/ML Course<\/a><\/div>\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p>DBSCAN Clustering stands out as a clustering algorithm because it identifies groups of data points based on density and separates noise without forcing every point into a cluster.<\/p>\n\n\n\n<p>It handles irregular shapes better than many traditional methods and offers flexibility for real-world datasets.<\/p>\n\n\n\n<p>With the right approach, DBSCAN becomes a reliable choice for tasks such as anomaly detection and scientific research. Experiment with different parameters, then decide where DBSCAN Clustering delivers the best fit.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>FAQs<\/strong><\/h2>\n\n\n<div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-question-1793708060636\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">1. <strong>What is DBSCAN Clustering used for?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>It finds arbitrarily shaped clusters and outliers, for example, in geospatial analysis, anomaly detection and image segmentation.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1793708072618\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">2. <strong>What are core, border and noise points in DBSCAN?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>A core point has at least <code>min_samples<\/code> points within <code>eps<\/code>, a border point lies within <code>eps<\/code> of a core point without being core, and a noise point is neither.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1793708073346\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">3. <strong>How do you choose eps and min_samples?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Set <code>min_samples<\/code> from the feature count (at least features plus one, often twice the features) and read <code>eps<\/code> from the elbow of the k-distance graph.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1793708074403\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">4. <strong>What does -1 mean in DBSCAN labels?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>It marks noise points that belong to no cluster.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1793708075385\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">5. Is DBSCAN better than K-Means?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>It is better for non-spherical clusters, outliers and an unknown cluster count, while K-Means is better for large datasets with compact, similar-sized clusters.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1793708142939\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">6. <strong>What is the time complexity of DBSCAN?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>It averages O(n log n) with a spatial index and degrades to O(n\u00b2) without one.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1793708157015\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">7. <strong>Can DBSCAN handle clusters of different densities?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Not well, because it uses a single <code>eps<\/code>, and HDBSCAN or OPTICS suit this case better.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>DBSCAN Clustering (Density-Based Spatial Clustering of Applications with Noise) is an unsupervised algorithm that groups points lying in densely packed regions and labels points in sparse regions as noise. It requires no preset number of clusters and can recover clusters of arbitrary shape, making it a common alternative to K-Means for irregular, noisy data. TL;DR [&hellip;]<\/p>\n","protected":false},"author":64,"featured_media":90587,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[933],"tags":[],"views":"4841","authorinfo":{"name":"Abhishek Pati","url":"https:\/\/www.guvi.in\/blog\/author\/abhishek-pati\/"},"thumbnailURL":"https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2025\/10\/What-is-DBSCAN-Clustering-in-Machine-Learning_-300x116.png","_links":{"self":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts\/87081"}],"collection":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/users\/64"}],"replies":[{"embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/comments?post=87081"}],"version-history":[{"count":12,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts\/87081\/revisions"}],"predecessor-version":[{"id":145859,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts\/87081\/revisions\/145859"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/media\/90587"}],"wp:attachment":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/media?parent=87081"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/categories?post=87081"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/tags?post=87081"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}