Density Clustering
FPC::d Bscan
Dbscan Core idea: If a point, within the range of its EPs, is not less than minpts points, then the point is the core point. A cluster is formed between the core and its neighbors within the EPS range. In a cluster, if more than one point appears to be the core point, the clusters centered on these core points are merged. Note that the parameter EPS settings, if the EPS is set too large, then all points will be grouped into a cluster, if set too small, then the number of clusters will be too many. If the minpts is set too large, many points will be considered noise points (calculate the distance matrix first, then look at the approximate distance, and find a reliable setting for the radius)
Advantages:
- Insensitive to noise.
- Can find any shape of the cluster.
Disadvantages:
- The results of clustering have a great relationship with the parameters.
- Dbscan Use fixed parameters to identify clusters, but when the degree of sparse clustering is different, the same criteria may destroy the natural structure of the cluster, that is, the more sparse clusters are divided into multiple classes or dense and relatively close to the class will be merged into a cluster
> Library (FPC)# as before, remove the species attribute from the Data sample > DS <-dbscan (Iris2, eps=0.42, minpts=5 )# Compare clusters with original class labels> table (ds$cluster, iris$species) Setosa versicolor virginica 0 2 1 0 0 2 0 PNs 0 3 0 3 33
In the above data table, 1 to 3 is the identified 3 clusters, and 0 represents the noise data or the point of interest, that is, objects that do not belong to any cluster.
Plot (ds, IRIS2)
View partial feature map plot (Ds,iris2[c (1,4)))
The FPC package also provides another function plotcluster () that shows the clustering analysis, and it is worth mentioning that the data will be projected into different clusters
Plotcluster (Iris2, Ds$cluster)
Resources:
- https://www.douban.com/note/495288321/
- http://www.36dsj.com/archives/63216
- Https://cran.r-project.org/web/packages/dbscan/index.html
ML: Clustering algorithm R packet-density clustering