{"id":219518,"date":"2025-03-06T12:35:05","date_gmt":"2025-03-06T17:35:05","guid":{"rendered":"https:\/\/ibkrcampus.com\/campus\/?p=219518"},"modified":"2025-03-06T12:35:57","modified_gmt":"2025-03-06T17:35:57","slug":"dbscan-vs-k-means","status":"publish","type":"post","link":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dbscan-vs-k-means\/","title":{"rendered":"DBSCAN Vs K-Means"},"content":{"rendered":"\n<p><em>The post &#8220;DBSCAN Vs K-Means&#8221; was originally published on <a href=\"https:\/\/blog.quantinsti.com\/dbscan-vs-kmeans\/\">QuantInsti<\/a> blog.<\/em><\/p>\n\n\n\n<p>You know that machine learning can be broadly categorised into supervised and unsupervised learning. Supervised learning uses labelled data, where the model learns from input-output pairs to make predictions or classifications.<\/p>\n\n\n\n<p>On the other hand, unsupervised learning works with unlabeled data to discover hidden patterns or structures. For instance, it can group similar items together or identify overarching trends, such as market regimes.<\/p>\n\n\n\n<p>In the realm of unsupervised learning, K-means clustering is a popular choice among analysts. If you ask anyone for a one line explanation of K-means, they will tell you that it organises data into distinct groups based on similarity. That\u2019s pretty good, but everything has its limitations and K-means is no exception.<\/p>\n\n\n\n<p>So today, we will first delve a bit on how K-means works, its limitation and how DBSCAN model can overcome these limitations. Along the way, we will use examples so it doesn\u2019t feel like a theoretical lecture. Let us first start with the content in this blog.<\/p>\n\n\n\n<p><strong>Prerequisites<\/strong><\/p>\n\n\n\n<p>To fully benefit from the concepts discussed here, it\u2019s crucial to have a solid foundation. Refresh your fundamentals, start with these blogs:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/blog.quantinsti.com\/unsupervised-learning\/\">An Introduction to Unsupervised Learning for Trading<\/a>&nbsp;\u2013 Discover how techniques like clustering can unearth hidden market patterns.<\/li>\n\n\n\n<li><a href=\"https:\/\/blog.quantinsti.com\/k-means-clustering-pair-selection-python\/\">K-Means Clustering Algorithm for Pair Selection in Python<\/a>&nbsp;\u2013 Learn how to apply K-Means to identify potential pair trades and automate the process in Python.<\/li>\n<\/ul>\n\n\n\n<p>We will cover the following topics:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Brief Description of the K-means Clustering Algorithm<\/li>\n\n\n\n<li>Limitation of the K-means Clustering Algorithm<\/li>\n\n\n\n<li>How does DBSCAN overcome the limitation of K-means<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"brief-description-of-the-k-means-clustering-algorithm\">Brief Description of the K-means Clustering Algorithm<\/h2>\n\n\n\n<p>To illustrate how K-means algorithm works, we will take an example in the trading domain to understand the process of K-means clustering algorithm.<\/p>\n\n\n\n<p>Let\u2019s say you&#8217;re observing the stock price of Apple. Each day, you calculate two technical indicators for Apple:&nbsp;<a href=\"https:\/\/blog.quantinsti.com\/rsi-indicator\/\">RSI<\/a>&nbsp;(which measures overbought or oversold conditions) and&nbsp;<a href=\"https:\/\/blog.quantinsti.com\/adx-indicator-python\/\">ADX<\/a>&nbsp;(which measures trend strength).<\/p>\n\n\n\n<p>You think to yourself, can I know if the stock is in a bullish, bearish or sideways phase by looking at these two indicator values?<\/p>\n\n\n\n<p>For example, if both RSI and ADX indicator values are high, you might assume that the stock is in the bullish phase.<\/p>\n\n\n\n<p>But what should be the threshold to decide that the stock is in the bullish phase?<\/p>\n\n\n\n<p>This is where you could use the unsupervised learning model: K-means.<\/p>\n\n\n\n<p>Let\u2019s see how you can use K-means clustering to classify the stock&#8217;s behaviour into different regimes:<\/p>\n\n\n\n<p>First, decide how many regimes you want to classify the stock into. For simplicity, let&#8217;s choose K = 3. These three clusters will represent potential stock regimes: bullish, bearish, and sideways range.<\/p>\n\n\n\n<p>Next, the algorithm first randomly select three initial &#8220;centres&#8221; in the RSI-ADX space. Think of these centres as hypothetical regimes that the model will adjust to better represent the actual data.<\/p>\n\n\n\n<p>For each day in your dataset:<\/p>\n\n\n\n<p>The algorithm checks its RSI and ADX values. Then it will calculate the distance between that day&#8217;s data point and each of the three centres. And finally, it will assign the day to the cluster whose centre is closest.<\/p>\n\n\n\n<p>For example:<\/p>\n\n\n\n<p>&#8211; A day with a high RSI and a high ADX might be assigned to the bullish cluster.<\/p>\n\n\n\n<p>&#8211; A day with a low RSI and a low ADX might fall into the bearish cluster.<\/p>\n\n\n\n<p>&#8211; A day with moderate RSI and low ADX might belong to the sideways range cluster.<\/p>\n\n\n\n<p>After assigning all days to clusters, the algorithm again calculates the average RSI and ADX values of all days in each cluster. These averages become the new centres of the clusters. The clusters now represent the actual &#8220;centres&#8221; of the regimes based on your data.<\/p>\n\n\n\n<p><strong>This process is repeated&nbsp;<\/strong>until the centres stop moving significantly.<\/p>\n\n\n\n<p>Now, you will have three clusters classifying the stock data into bullish, bearish, and sideways range regimes.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"720\" height=\"432\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/K-Means-clustering-1-quantinsti.jpg\" alt=\"\" class=\"wp-image-219521 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/K-Means-clustering-1-quantinsti.jpg 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/K-Means-clustering-1-quantinsti-700x420.jpg 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/K-Means-clustering-1-quantinsti-300x180.jpg 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/432;\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center has-cyan-bluish-gray-color has-text-color has-link-color wp-elements-e8bc001248eb400fd7ec44a600487121\">Clustering Process Using K-means<\/p>\n\n\n\n<p>This sounds great! So what exactly is the limitation of K-means?<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"limitation-of-the-k-means-clustering-algorithm\">Limitation of the K-means Clustering Algorithm<\/h2>\n\n\n\n<p>The k in k means has to be decided beforehand. Ideally, we can use the \u2018within-cluster-sum-of-squares\u2019 or WCSS method to find the ideal number of clusters.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" width=\"720\" height=\"406\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Elbow-curve-1-quantinsti.jpg\" alt=\"\" class=\"wp-image-219523 lazyload\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/406;width:720px;height:auto\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Elbow-curve-1-quantinsti.jpg 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Elbow-curve-1-quantinsti-700x395.jpg 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Elbow-curve-1-quantinsti-300x169.jpg 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center has-cyan-bluish-gray-color has-text-color has-link-color wp-elements-045d24b110c13dfb5f03f8e87516e2eb\">Within-cluster-sum-of-squares (WCSS) graph with decline<\/p>\n\n\n\n<p>But there can be times when there is no apparent decline in the graph.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"720\" height=\"403\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Elbow-curve-with-no-clear-declining-1-quantinsti.png\" alt=\"\" class=\"wp-image-219525 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Elbow-curve-with-no-clear-declining-1-quantinsti.png 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Elbow-curve-with-no-clear-declining-1-quantinsti-700x392.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Elbow-curve-with-no-clear-declining-1-quantinsti-300x168.png 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/403;\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center has-cyan-bluish-gray-color has-text-color has-link-color wp-elements-9796026d2b1e31dfc5001fe94b5827f9\">WCSS graph with no clear declining point<\/p>\n\n\n\n<p>K means uses a centroid (centre point) and considers points in a cluster, \u201ccluster\u201d or stick together. Another way to explain is it assumes that clusters are spheres of equal size. But there can be times when this is not the case. What if the clusters are not regularly shaped?<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"720\" height=\"437\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Illustration-of-Points-For-Clustering-Process-1-quantinsti.png\" alt=\"\" class=\"wp-image-219526 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Illustration-of-Points-For-Clustering-Process-1-quantinsti.png 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Illustration-of-Points-For-Clustering-Process-1-quantinsti-700x425.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Illustration-of-Points-For-Clustering-Process-1-quantinsti-300x182.png 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/437;\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center has-cyan-bluish-gray-color has-text-color has-link-color wp-elements-1b0261a4bf0522b71199e44ed2b4b50c\">Illustration of Points For Clustering Process<\/p>\n\n\n\n<p>Here, you can see that there are two circles, inner and outer circle. And you will cluster the points in the same manner. But K-means clustering algorithm thinks differently.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"720\" height=\"437\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Clustering-According-to-K-means-1-quantinsti.png\" alt=\"\" class=\"wp-image-219528 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Clustering-According-to-K-means-1-quantinsti.png 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Clustering-According-to-K-means-1-quantinsti-700x425.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Clustering-According-to-K-means-1-quantinsti-300x182.png 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/437;\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center has-cyan-bluish-gray-color has-text-color has-link-color wp-elements-11b6448adbfa30a92a08cec2bddfad89\">Clustering According to K-means<\/p>\n\n\n\n<p>The k means algorithm will split it into two to form two clusters, as shown above.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"720\" height=\"437\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Similarity-of-points-A-and-B-But-Classified-in-Different-Clusters-3-quantinsti.png\" alt=\"\" class=\"wp-image-219531 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Similarity-of-points-A-and-B-But-Classified-in-Different-Clusters-3-quantinsti.png 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Similarity-of-points-A-and-B-But-Classified-in-Different-Clusters-3-quantinsti-700x425.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Similarity-of-points-A-and-B-But-Classified-in-Different-Clusters-3-quantinsti-300x182.png 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/437;\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center has-cyan-bluish-gray-color has-text-color has-link-color wp-elements-59e0dc3e0c32426a761cb954695e426d\">Similarity of points A and B But Classified in Different Clusters<\/p>\n\n\n\n<p>You can see that A and B have more in common with each other but due to the centroid based distance approach, they are in different clusters.<\/p>\n\n\n\n<p>Is there a different approach which can work better?<\/p>\n\n\n\n<p>Yes! Let\u2019s see how the DBSCAN algorithm overcomes this limitation.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-does-dbscan-overcome-the-limitation-of-k-means\">How does DBSCAN overcome the Limitation of K-means<\/h2>\n\n\n\n<p>Density-based spatial clustering of applications with noise (DBSCAN) is a clustering technique that can deal with the noise in the data.<\/p>\n\n\n\n<p>The unique thing about this algorithm is that you don\u2019t have to set the number of clusters beforehand. The algorithm does that work for you!<\/p>\n\n\n\n<p>DBSCAN clustering requires two parameters.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Distance parameter: It is the maximum distance between two points for them to be in the neighbourhood of each other. We will call this epsilon.<\/li>\n\n\n\n<li>Minimum number of points required in the cluster, including itself, in the neighbourhood of a point.<\/li>\n<\/ol>\n\n\n\n<p>But how do you define the neighbourhood of a point?<\/p>\n\n\n\n<p>Let\u2019s take an example. Consider a point.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"720\" height=\"437\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Epsilon-1-quantinsti.png\" alt=\"\" class=\"wp-image-219535 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Epsilon-1-quantinsti.png 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Epsilon-1-quantinsti-700x425.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Epsilon-1-quantinsti-300x182.png 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/437;\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center has-cyan-bluish-gray-color has-text-color has-link-color wp-elements-c68aaa72b10d164afd7c9af8ce82396f\">Illustration of Epsilon From Point<\/p>\n\n\n\n<p>If we draw a circle with a point as it&#8217;s centre and radius equal to epsilon. The circle is called the neighbourhood of the point. Based on the dataset you are working with, you can define the neighbourhood of the point.<\/p>\n\n\n\n<p>Let\u2019s see how the DBSCAN clustering method works now. Consider the points as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"720\" height=\"338\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Illustration-of-Points-for-Explanation-of-DBSCAN-Clustering-1-quantinsti.png\" alt=\"\" class=\"wp-image-219537 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Illustration-of-Points-for-Explanation-of-DBSCAN-Clustering-1-quantinsti.png 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Illustration-of-Points-for-Explanation-of-DBSCAN-Clustering-1-quantinsti-700x329.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Illustration-of-Points-for-Explanation-of-DBSCAN-Clustering-1-quantinsti-300x141.png 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/338;\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center has-cyan-bluish-gray-color has-text-color has-link-color wp-elements-be65eab498b5668c8ffd76cbb00a4c14\">Illustration of Points for Explanation of DBSCAN Clustering<\/p>\n\n\n\n<p>First we will set the parameters of DBSCAN as follows:<\/p>\n\n\n\n<p>Epsilon equals to 2<\/p>\n\n\n\n<p>Minimum number of points as 4.<\/p>\n\n\n\n<p>We will go through the graph one by one.<\/p>\n\n\n\n<p>For point A, draw a circle with radius 2 units around it.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" width=\"720\" height=\"403\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Illustration-of-Process-of-Identifying-Cluster-Starting-with-Point-A-1-quantinsti-2.png\" alt=\"\" class=\"wp-image-219538 lazyload\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/403;width:720px;height:auto\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Illustration-of-Process-of-Identifying-Cluster-Starting-with-Point-A-1-quantinsti-2.png 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Illustration-of-Process-of-Identifying-Cluster-Starting-with-Point-A-1-quantinsti-2-700x392.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Illustration-of-Process-of-Identifying-Cluster-Starting-with-Point-A-1-quantinsti-2-300x168.png 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center has-cyan-bluish-gray-color has-text-color has-link-color wp-elements-c2bfa0998c075b9b6f10d72bc20425f3\">Illustration of Process of Identifying Cluster Starting with Point A<\/p>\n\n\n\n<p>How many points do you see in the neighbourhood of point A? None. Hence, point A is an outlier. It will not be a part of the cluster.<\/p>\n\n\n\n<p>Next, move the circle to point B.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" width=\"720\" height=\"403\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Illustration-of-Process-of-Identifying-Cluster-with-Point-B-1-quantinsti.png\" alt=\"\" class=\"wp-image-219540 lazyload\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/403;width:720px;height:auto\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Illustration-of-Process-of-Identifying-Cluster-with-Point-B-1-quantinsti.png 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Illustration-of-Process-of-Identifying-Cluster-with-Point-B-1-quantinsti-700x392.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Illustration-of-Process-of-Identifying-Cluster-with-Point-B-1-quantinsti-300x168.png 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center has-cyan-bluish-gray-color has-text-color has-link-color wp-elements-639703be0ea0eb0ffb17e512634001f9\">Illustration of Process of Identifying Cluster with Point B<\/p>\n\n\n\n<p>As you can see, it has 4 points in it\u2019s neighbourhood. This is equal to the minimum number of points required. Such a point is called a core point.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" width=\"720\" height=\"403\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Classification-of-Point-B-as-Core-Point-1-quantinsti.png\" alt=\"\" class=\"wp-image-219542 lazyload\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/403;width:720px;height:auto\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Classification-of-Point-B-as-Core-Point-1-quantinsti.png 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Classification-of-Point-B-as-Core-Point-1-quantinsti-700x392.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Classification-of-Point-B-as-Core-Point-1-quantinsti-300x168.png 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center has-cyan-bluish-gray-color has-text-color has-link-color wp-elements-3997709123e0abf25651fa72d127dced\">Classification of Point B as Core Point<\/p>\n\n\n\n<p>Let&#8217;s represent the core point using a colour, say red. And all the other points in its neighbourhood by using light red. The light red points are called the boundary points.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"720\" height=\"403\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Marking-cluster-as-red-for-core-point-B-1-1-quantinsti-2.png\" alt=\"\" class=\"wp-image-219543 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Marking-cluster-as-red-for-core-point-B-1-1-quantinsti-2.png 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Marking-cluster-as-red-for-core-point-B-1-1-quantinsti-2-700x392.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Marking-cluster-as-red-for-core-point-B-1-1-quantinsti-2-300x168.png 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/403;\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center has-cyan-bluish-gray-color has-text-color has-link-color wp-elements-ce4f5dc9cd307a86f0744ee0a47c8fa9\">Marking Cluster as Red for Core Point B and its Boundary Points<\/p>\n\n\n\n<p>We will continue to move the circle to point C. As point C has 4 points in its neighbourhood, it is also a core point.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"720\" height=\"403\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Point-C-1-quantinsti.png\" alt=\"\" class=\"wp-image-219545 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Point-C-1-quantinsti.png 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Point-C-1-quantinsti-700x392.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Point-C-1-quantinsti-300x168.png 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/403;\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center has-cyan-bluish-gray-color has-text-color has-link-color wp-elements-80bc106bd9ae620f9fde9bb81b986444\">Identification of Cluster Using Point C<\/p>\n\n\n\n<p>Is point D also a core point? No. It has only 3 points, including itself, in its neighbourhood. Therefore it is not a core point. It is a boundary point.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"720\" height=\"403\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Cluster-using-point-D-quantinsti.png\" alt=\"\" class=\"wp-image-219546 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Cluster-using-point-D-quantinsti.png 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Cluster-using-point-D-quantinsti-700x392.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Cluster-using-point-D-quantinsti-300x168.png 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/403;\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center has-cyan-bluish-gray-color has-text-color has-link-color wp-elements-49d6240e5fb346c36c80c84bbb1a5959\">Identification of Cluster Using Point D<\/p>\n\n\n\n<p>What about point E? It has only 2 points in its neighbourhood.<\/p>\n\n\n\n<p>A point is classified into a cluster if it is a core point. A point is also classified into a cluster if it is a boundary point in the neighbourhood of a core point, i.e. if it lies at a distance of less than epsilon from a core point.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" width=\"720\" height=\"403\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Cluster-using-point-E-quantinsti.png\" alt=\"\" class=\"wp-image-219548 lazyload\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/403;width:720px;height:auto\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Cluster-using-point-E-quantinsti.png 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Cluster-using-point-E-quantinsti-700x392.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Cluster-using-point-E-quantinsti-300x168.png 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center has-cyan-bluish-gray-color has-text-color has-link-color wp-elements-c406a579cdcebf3bf491a57e46bc64a7\">Identification of Cluster Using Point E\u200c\u200c<\/p>\n\n\n\n<p>Point E does not satisfy any of the given criteria. Hence, it does not classify into a cluster and is treated as an outlier.<\/p>\n\n\n\n<p>Next, consider the 4 points at the bottom-left. Will they belong to a cluster? All the 4 points lie in the neighbourhood of point F.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" width=\"720\" height=\"403\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Cluster-using-point-F-quantinsti.png\" alt=\"\" class=\"wp-image-219549 lazyload\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/403;width:950px;height:auto\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Cluster-using-point-F-quantinsti.png 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Cluster-using-point-F-quantinsti-700x392.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Cluster-using-point-F-quantinsti-300x168.png 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center has-cyan-bluish-gray-color has-text-color has-link-color wp-elements-5bdfec917129cd7da4a163dec9e615e6\">Identification of Cluster Using Point F<\/p>\n\n\n\n<p>Hence, they form a cluster. We will represent this cluster in blue colour.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"720\" height=\"403\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Classification-of-Point-F-as-Core-Point-quantinsti-2.png\" alt=\"\" class=\"wp-image-219551 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Classification-of-Point-F-as-Core-Point-quantinsti-2.png 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Classification-of-Point-F-as-Core-Point-quantinsti-2-700x392.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Classification-of-Point-F-as-Core-Point-quantinsti-2-300x168.png 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/403;\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center has-cyan-bluish-gray-color has-text-color has-link-color wp-elements-4cfd1d130ac8429aec50d97c380f457c\">Classification of Point F as Core Point<\/p>\n\n\n\n<p>Not only point F, but all the other points in the cluster are also core points.<\/p>\n\n\n\n<p>Therefore, we have two clusters with the given points.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"720\" height=\"403\" data-src=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Two-Clusters-Identified-Using-DBSCAN-quantinsti.png\" alt=\"\" class=\"wp-image-219552 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Two-Clusters-Identified-Using-DBSCAN-quantinsti.png 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Two-Clusters-Identified-Using-DBSCAN-quantinsti-700x392.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2025\/03\/Two-Clusters-Identified-Using-DBSCAN-quantinsti-300x168.png 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/403;\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center has-cyan-bluish-gray-color has-text-color has-link-color wp-elements-6ecd45291efd9cb81eb87284b52db434\">Two Clusters Identified Using DBSCAN\u200c\u200c<\/p>\n\n\n\n<p>This is essentially how the DBSCAN algorithm works. It creates clusters based on the density of the points, i.e. the number of points in the neighbourhood of a point. And this is the motivation behind the name of the algorithm.<\/p>\n\n\n\n<p>That\u2019s great, isn\u2019t it?<\/p>\n\n\n\n<p>The DBSCAN clustering improved the way the K-means algorithm works. You can use the sklearn python library to implement the DBSCAN algorithm in your Python notebook.<\/p>\n\n\n\n<p>You can learn more about the working of each K-means and DBSCAN clustering by exploring the course titled&nbsp;<a href=\"https:\/\/quantra.quantinsti.com\/course\/unsupervised-learning-trading\">Unsupervised Learning in Trading<\/a>!<\/p>\n\n\n\n<p><strong>Continue Learning:<\/strong><br><br><strong>1. Expand your knowledge with the following blogs:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/blog.quantinsti.com\/machine-learning-k-nearest-neighbors-knn-algorithm-python\/\"><strong>K-Nearest Neighbors Algorithm: Steps to Implement in Python<\/strong><\/a>&nbsp;\u2013 A beginner-friendly guide that walks you through using KNN for classification and regression.<\/li>\n\n\n\n<li><a href=\"https:\/\/blog.quantinsti.com\/top-10-machine-learning-algorithms-beginners\/\"><strong>Top 10 Machine Learning Algorithms for Beginners<\/strong><\/a>&nbsp;\u2013 Get a quick rundown of popular ML algorithms and how they fit into trading strategy design.<\/li>\n<\/ul>\n\n\n\n<p>For a deeper dive, download our<a href=\"https:\/\/www.quantinsti.com\/machine-learning-trading-book\">&nbsp;<strong>Machine Learning for Trading eBook<\/strong><\/a>, which covers the core concepts in more detail and provides practical tips for building ML-driven strategies.<\/p>\n\n\n\n<p><strong>2. Deep Dive with Quantra<\/strong><\/p>\n\n\n\n<p>If you\u2019re ready to go a step further,&nbsp;<a href=\"https:\/\/quantra.quantinsti.com\/learning-track\/machine-learning-deep-learning-trading-2\">Quantra&#8217;s Learning Track on Artificial Intelligence in Trading Advanced<\/a>&nbsp;offers a structured learning track from Intermediate to Advanced. This progression helps you steadily build expertise on complete lifecycle of strategy creation and backtesting using advanced artificial intelligence in trading, including neural network, deep learning, and LLMs.<\/p>\n\n\n\n<p><strong>3. Taking a Structured Approach with EPAT<\/strong><\/p>\n\n\n\n<p>For a comprehensive, hands-on program that covers the entire spectrum of algorithmic trading and machine learning, consider the<a href=\"https:\/\/www.quantinsti.com\/epat\">&nbsp;<strong>Executive Programme in Algorithmic Trading (EPAT)<\/strong><\/a>.<\/p>\n\n\n\n<p>Check out the EPAT Projects by Students:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/blog.quantinsti.com\/predict-price-trend-metals-machine-learning-project-holger\/\">Prediction of the price trend of Metals with Machine Learning<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/blog.quantinsti.com\/portfolio-assets-allocation-machine-learning-project-raimondo-marino\/\">Portfolio Assets Allocation with Machine Learning<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/blog.quantinsti.com\/machine-learning-model-long-only-strategy-retail-trader-project-pranav-lal\/\">Building a Machine Learning model for a Long-only strategy to be used as a Retail Trader<\/a><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h3>\n\n\n\n<p>While the K-means algorithm is a robust clustering algorithm, it has certain limitations which might limit the scope of implementation. Also, you need to specify the clusters to be formed, which lead to certain bias. In contrast, the DBSCAN algorithm uses a different approach to cluster datapoints based on the density or distribution of the datapoints.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the realm of unsupervised learning, K-means clustering is a popular choice among analysts. <\/p>\n","protected":false},"author":91,"featured_media":21725,"comment_status":"open","ping_status":"closed","sticky":true,"template":"","format":"standard","meta":{"_acf_changed":true,"footnotes":""},"categories":[339,338,341],"tags":[18618,18614,18615,18617,852,595,16878,18616],"contributors-categories":[13654],"class_list":{"0":"post-219518","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-data-science","8":"category-ibkr-quant-news","9":"category-quant-development","10":"tag-average-directional-index-adx","11":"tag-dbscan","12":"tag-k-means","13":"tag-k-means-clustering-algorithm","14":"tag-machine-learning","15":"tag-python","16":"tag-relative-strength-index-rsi","17":"tag-unsupervised-learning-for-trading","18":"contributors-categories-quantinsti"},"pp_statuses_selecting_workflow":false,"pp_workflow_action":"current","pp_status_selection":"publish","acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>DBSCAN Vs K-Means | IBKR Quant<\/title>\n<meta name=\"description\" content=\"In the realm of unsupervised learning, K-means clustering is a popular choice among analysts.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/219518\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"DBSCAN Vs K-Means\" \/>\n<meta property=\"og:description\" content=\"In the realm of unsupervised learning, K-means clustering is a popular choice among analysts.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dbscan-vs-k-means\/\" \/>\n<meta property=\"og:site_name\" content=\"IBKR Campus US\" \/>\n<meta property=\"article:published_time\" content=\"2025-03-06T17:35:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-06T17:35:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2019\/10\/cluster-grid.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1100\" \/>\n\t<meta property=\"og:image:height\" content=\"700\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Rekhit Pachanekar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rekhit Pachanekar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\n\t    \"@context\": \"https:\\\/\\\/schema.org\",\n\t    \"@graph\": [\n\t        {\n\t            \"@type\": \"NewsArticle\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/dbscan-vs-k-means\\\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/dbscan-vs-k-means\\\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Rekhit Pachanekar\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/8ab08253f8958ae9552fd7d7b5697370\"\n\t            },\n\t            \"headline\": \"DBSCAN Vs K-Means\",\n\t            \"datePublished\": \"2025-03-06T17:35:05+00:00\",\n\t            \"dateModified\": \"2025-03-06T17:35:57+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/dbscan-vs-k-means\\\/\"\n\t            },\n\t            \"wordCount\": 1865,\n\t            \"commentCount\": 0,\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/dbscan-vs-k-means\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2019\\\/10\\\/cluster-grid.jpg\",\n\t            \"keywords\": [\n\t                \"Average Directional Index (ADX)\",\n\t                \"DBSCAN\",\n\t                \"K-Means\",\n\t                \"K-means Clustering Algorithm\",\n\t                \"Machine Learning\",\n\t                \"Python\",\n\t                \"Relative Strength Index (RSI)\",\n\t                \"Unsupervised Learning for Trading\"\n\t            ],\n\t            \"articleSection\": [\n\t                \"Data Science\",\n\t                \"Quant\",\n\t                \"Quant Development\"\n\t            ],\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"CommentAction\",\n\t                    \"name\": \"Comment\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/dbscan-vs-k-means\\\/#respond\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/dbscan-vs-k-means\\\/\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/dbscan-vs-k-means\\\/\",\n\t            \"name\": \"DBSCAN Vs K-Means | IBKR Campus US\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\"\n\t            },\n\t            \"primaryImageOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/dbscan-vs-k-means\\\/#primaryimage\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/dbscan-vs-k-means\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2019\\\/10\\\/cluster-grid.jpg\",\n\t            \"datePublished\": \"2025-03-06T17:35:05+00:00\",\n\t            \"dateModified\": \"2025-03-06T17:35:57+00:00\",\n\t            \"description\": \"In the realm of unsupervised learning, K-means clustering is a popular choice among analysts.\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"ReadAction\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/dbscan-vs-k-means\\\/\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"ImageObject\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/dbscan-vs-k-means\\\/#primaryimage\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2019\\\/10\\\/cluster-grid.jpg\",\n\t            \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2019\\\/10\\\/cluster-grid.jpg\",\n\t            \"width\": 1100,\n\t            \"height\": 700,\n\t            \"caption\": \"Algo Trading Clustering\"\n\t        },\n\t        {\n\t            \"@type\": \"WebSite\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"name\": \"IBKR Campus US\",\n\t            \"description\": \"Financial Education from Interactive Brokers\",\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"SearchAction\",\n\t                    \"target\": {\n\t                        \"@type\": \"EntryPoint\",\n\t                        \"urlTemplate\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/?s={search_term_string}\"\n\t                    },\n\t                    \"query-input\": {\n\t                        \"@type\": \"PropertyValueSpecification\",\n\t                        \"valueRequired\": true,\n\t                        \"valueName\": \"search_term_string\"\n\t                    }\n\t                }\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"Organization\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\",\n\t            \"name\": \"Interactive Brokers\",\n\t            \"alternateName\": \"IBKR\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"logo\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\",\n\t                \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"width\": 669,\n\t                \"height\": 669,\n\t                \"caption\": \"Interactive Brokers\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\"\n\t            },\n\t            \"publishingPrinciples\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/about-ibkr-campus\\\/\",\n\t            \"ethicsPolicy\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/cyber-security-notice\\\/\"\n\t        },\n\t        {\n\t            \"@type\": \"Person\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/8ab08253f8958ae9552fd7d7b5697370\",\n\t            \"name\": \"Rekhit Pachanekar\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/author\\\/rekhit\\\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"DBSCAN Vs K-Means | IBKR Quant","description":"In the realm of unsupervised learning, K-means clustering is a popular choice among analysts.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/219518\/","og_locale":"en_US","og_type":"article","og_title":"DBSCAN Vs K-Means","og_description":"In the realm of unsupervised learning, K-means clustering is a popular choice among analysts.","og_url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dbscan-vs-k-means\/","og_site_name":"IBKR Campus US","article_published_time":"2025-03-06T17:35:05+00:00","article_modified_time":"2025-03-06T17:35:57+00:00","og_image":[{"width":1100,"height":700,"url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2019\/10\/cluster-grid.jpg","type":"image\/jpeg"}],"author":"Rekhit Pachanekar","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Rekhit Pachanekar","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/dbscan-vs-k-means\/#article","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/dbscan-vs-k-means\/"},"author":{"name":"Rekhit Pachanekar","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/8ab08253f8958ae9552fd7d7b5697370"},"headline":"DBSCAN Vs K-Means","datePublished":"2025-03-06T17:35:05+00:00","dateModified":"2025-03-06T17:35:57+00:00","mainEntityOfPage":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/dbscan-vs-k-means\/"},"wordCount":1865,"commentCount":0,"publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/dbscan-vs-k-means\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2019\/10\/cluster-grid.jpg","keywords":["Average Directional Index (ADX)","DBSCAN","K-Means","K-means Clustering Algorithm","Machine Learning","Python","Relative Strength Index (RSI)","Unsupervised Learning for Trading"],"articleSection":["Data Science","Quant","Quant Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/dbscan-vs-k-means\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/dbscan-vs-k-means\/","url":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/dbscan-vs-k-means\/","name":"DBSCAN Vs K-Means | IBKR Campus US","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/dbscan-vs-k-means\/#primaryimage"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/dbscan-vs-k-means\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2019\/10\/cluster-grid.jpg","datePublished":"2025-03-06T17:35:05+00:00","dateModified":"2025-03-06T17:35:57+00:00","description":"In the realm of unsupervised learning, K-means clustering is a popular choice among analysts.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/dbscan-vs-k-means\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/dbscan-vs-k-means\/#primaryimage","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2019\/10\/cluster-grid.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2019\/10\/cluster-grid.jpg","width":1100,"height":700,"caption":"Algo Trading Clustering"},{"@type":"WebSite","@id":"https:\/\/ibkrcampus.com\/campus\/#website","url":"https:\/\/ibkrcampus.com\/campus\/","name":"IBKR Campus US","description":"Financial Education from Interactive Brokers","publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ibkrcampus.com\/campus\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ibkrcampus.com\/campus\/#organization","name":"Interactive Brokers","alternateName":"IBKR","url":"https:\/\/ibkrcampus.com\/campus\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","width":669,"height":669,"caption":"Interactive Brokers"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/"},"publishingPrinciples":"https:\/\/www.interactivebrokers.com\/campus\/about-ibkr-campus\/","ethicsPolicy":"https:\/\/www.interactivebrokers.com\/campus\/cyber-security-notice\/"},{"@type":"Person","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/8ab08253f8958ae9552fd7d7b5697370","name":"Rekhit Pachanekar","url":"https:\/\/www.interactivebrokers.com\/campus\/author\/rekhit\/"}]}},"jetpack_featured_media_url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2019\/10\/cluster-grid.jpg","_links":{"self":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/219518","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/users\/91"}],"replies":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/comments?post=219518"}],"version-history":[{"count":0,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/219518\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media\/21725"}],"wp:attachment":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media?parent=219518"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/categories?post=219518"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/tags?post=219518"},{"taxonomy":"contributors-categories","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/contributors-categories?post=219518"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}