graphclust.cluster.DensityPeaks#
- class graphclust.cluster.DensityPeaks(n_clusters=3, *, density='gaussian', percent=2.0, k=10)[source]#
Bases:
ClusterMixin,BaseEstimatorClustering by fast search and find of density peaks (Rodriguez and Laio 2014).
For each sample the local density \(\rho_i\) (Gaussian kernel with cut-off \(d_c\) set to the
percentpercentile of the pairwise distances, or the inverse mean distance to theknearest neighbors whendensity="knn") and the distance \(\delta_i\) to the nearest sample of higher density are computed. Cluster centers are the samples with the largest \(\gamma_i=\rho_i\delta_i\) (they stand out in the \((\rho,\delta)\) decision graph); every other sample inherits the label of its nearest denser neighbor. The “nearest denser neighbor” links form a spanning tree directed towards the peaks.- Attributes:
- rho_, delta_, gamma_, nearest_denser_ (parent in the density tree), centers_