rithm two clusters get merged the length of each branch also shows how far apart the merged clusters are the longest branches in this dendrogram are the three lines that are marked by the dashed line labeled "three clusters that these are the longest branches indicates that going from three to two clusters meant merging some very far-apart points we see this again at the top of the chartwhere merging the two remaining clusters into single cluster again bridges relatively large distance unfortunatelyagglomerative clustering still fails at separating complex shapes like the two_moons dataset but the same is not true for the next algorithm we will look atdbscan dbscan another very useful clustering algorithm is dbscan (which stands for "densitybased spatial clustering of applications with noise"the main benefits of dbscan are that it does not require the user to set the number of clusters prioriit can capture clusters of complex shapesand it can identify points that are not part of any cluster dbscan is somewhat slower than agglomerative clustering and -meansbut still scales to relatively large datasets dbscan works by identifying points that are in "crowdedregions of the feature spacewhere many data points are close together these regions are referred to as dense regions in feature space the idea behind dbscan is that clusters form dense regions of dataseparated by regions that are relatively empty points that are within dense region are called core samples (or core points)and they are defined as follows there are two parameters in dbscanmin_samples and eps if there are at least min_samples many data points within distance of eps to given data pointthat data point is classified as core sample core samples that are closer to each other than the distance eps are put into the same cluster by dbscan the algorithm works by picking an arbitrary point to start with it then finds all points with distance eps or less from that point if there are less than min_samples points within distance eps of the starting pointthis point is labeled as noisemeaning that it doesn' belong to any cluster if there are more than min_samples points within distance of epsthe point is labeled core sample and assigned new cluster label thenall neighbors (within epsof the point are visited if they have not been assigned cluster yetthey are assigned the new cluster label that was just created if they are core samplestheir neighbors are visited in turnand so on the cluster grows until there are no more core samples within distance eps of the cluster then another point that hasn' yet been visited is pickedand the same procedure is repeated clustering