When we want to quickly distinguish between tagged data, it's easy to ignore unsupervised learning. Unsupervised机器 学习It is very powerful in itself, and clustering is by far the most common of these types of problems.
This is a quick solution to the three most popular clustering methods and which type of situation is most suitable.One thing that clustering and supervision problems have in common is that there is no silver bullet; each algorithm has its time and place, depending on the task you want to complete.This should give you some intuition, just like when to use them, with just a little bit of math.
Hierarchical clustering
Imagine you have some number of clustersķYou are interested in finding. All you know is that you can break down a dataset into many different groups at the top level, but you might also be interested in groups within a group or groups within those groups. To get this structure, we use hierarchical clustering.
We are fromnDifferent points and what we want to discoverkDifferent clusters start; in our case,n = 4,k = 2.
Think of each point as your own cluster first.
Then, we started to merge each single point cluster into a larger cluster, using the closest cluster. We find the minimum distance from the pairwise distance matrix-this is just a table of the distance of each cluster from the others.
This is initialized as the Euclidean distance between each point, but after that, we switch to one of the different ways of measuring cluster distance. If you are interested in learning more about these techniques, check out single link clustering, full link clustering, clique margins and Ward's method.
Anyway, we started to merge the closest clusters. Suppose we know that x1 and x3 are the closest. Then we merge the two into a new cluster,Ca.
We now recalculate the distance of each of the other clusters using our preference for the above grab. Then we repeat, merge our clusters over and over again until we getkTop clusters-in our case, two clusters. Suppose we find that x2 is closer to ca than x4.
We now have two top-level clusters, cb and x4 (remember, each point starts as its own cluster). We can now search the tree structure we created to search for subclusters, which looks like this in our original 2-D view:
Density-based clustering
Hierarchical clustering helps to understand any hidden structure in the data, but it has a major flaw. In the version shown above, we assume that every data point is related – this is almost not the case in the real world.
A density based clustering method provides a safety valve. We don't assume that each point is part of a cluster, but instead focus on closely packed points and assume that all other points are noise.
This method requires two parameters: radius ε and neighborhood density Σ. For each point, we calculate Neps(x)-the number of points with the most ε from x. If Neps(x)≥Σ and x is not calculated, then x is consideredCore point. If a point is not a core point, but it is a member of the core point neighborhood, then it is considered to beBoundary point. Everything else is considered to benoise.
One of the most common and actually performance-based implementations of density-based clustering is spatial clustering of density-based, noise-based applications, better known as DBSCAN. DBSCAN works by running a connected component algorithm across different core points. If two core points share a boundary point, or if the core point is a boundary point in the neighborhood of another core point, then they are part of the same connected component, which makes up a cluster.
Suppose we have a relatively small ε and a fairly large Σ. We may end such a cluster:
see? Those two lonely points are far from the two star clusters, and they really have no meaning-so they are just noise.
Note that we can also find non-convex clusters in this way (see orange arc). Very simple!
We don't need to specify some clusters of interest for density-based clustering-it will automatically discover some clusters based on your ε and Σ. This is especially useful when you want all clusters to have similar density.
K-Means clustering
Hierarchical clustering excels at discovering embedded structures in data, while density-based methods excel at finding unknown numbers of clusters with similar densities. However, neither can find a “consensus” in the entire data set. Hierarchical clustering puts clusters that look very close together, but does not consider information about other points. The density-based approach only looks at small neighborhoods of nearby points, and the complete data set cannot be considered.
This is where K-means clustering comes into play. In a sense, K-means considers each point in the data set and uses this information to evolve clusters in a series of iterations.
K-means by choicekCenter point orDevice to workSo choose K-Means. These averages are then used as the centroid of their cluster: any point closest to the given mean will be assigned to the cluster of the mean.
Once all points have been assigned, move each cluster and get an average of all the points it contains. This new "average" point is the new average of the cluster.
Just repeat these two steps until the point assignment stops changing!
Once the point assignment stops changing, the algorithm will converge.
We will have it nowkFor different clusters, the centroid of each cluster is closer to each point in its cluster than to any other centroid. Recalculating the centroid does not change the distribution, so we stop. This is all about K-means, but it's a very powerful way to find a known number of clusters when considering the entire data set.
There are many ways to initialize your funds. Forgy method randomly selects from the datakRandom observations and use them as a starting point. The random partitioning method assigns each point in the dataset to a random cluster, and then calculates the centroid based on these points and restores the algorithm.
Although K-means is an NP-hard problem, heuristics can find appropriate approximations of global optimals in polynomial time, and can effectively process large data sets, making it a reliable hierarchical clustering in some cases. select.
Clustering is a strange world with a more bizarre collection of techniques. These three methods are just some of the most popular methods, but they can help you find unknown groups in your data. Clustering is useful for exploratory data analysis, finding initialization points for other analyses, and deploying very simple. Using clusters wisely can provide amazing insights into your data. Consider another gap in your belt.
This article is transferred from medium,Original address
Comments