Calculates the element-wise element-centric similarity between two clustering results.

element_sim_elscore(
  clustering1,
  clustering2,
  alpha = 0.9,
  r_cl1 = 1,
  rescale_path_type_cl1 = "max",
  ppr_implementation_cl1 = "prpack",
  dist_rescaled_cl1 = FALSE,
  row_normalize_cl1 = TRUE,
  r_cl2 = 1,
  rescale_path_type_cl2 = "max",
  ppr_implementation_cl2 = "prpack",
  dist_rescaled_cl2 = FALSE,
  row_normalize_cl2 = TRUE
)

Arguments

clustering1

The first clustering result, which can be one of:

  • A numeric/character/factor vector of cluster labels for each element.

  • A samples x clusters matrix/Matrix::Matrix of nonzero membership values.

  • An hclust object.

clustering2

The second clustering result, which can be one of:

  • A numeric/character/factor vector of cluster labels for each element.

  • A samples x clusters matrix/Matrix::Matrix of nonzero membership values.

  • An hclust object.

alpha

A numeric giving the personalized PageRank damping factor; 1 - alpha is the restart probability for the PPR random walk.

r_cl1

A numeric hierarchical scaling parameter for the first clustering.

rescale_path_type_cl1

A string; rescale the hierarchical height of the first clustering by:

  • "max" : the maximum path from the root.

  • "min" : the minimum path form the root.

  • "linkage" : use the linkage distances in the clustering.

ppr_implementation_cl1

Choose a implementation for personalized page-rank calculation for the first clustering:

  • "prpack": use PPR algorithms in igraph.

  • "power_iteration": use power_iteration method.

dist_rescaled_cl1

A logical: if TRUE, the linkage distances of the first clustering are linearly rescaled to be in-between 0 and 1.

row_normalize_cl1

Whether to normalize all rows in the first clustering so they sum to one before calculating ECS. It is recommended to set this to TRUE, which will lead to slightly different ECS values compared to clusim.

r_cl2

A numeric hierarchical scaling parameter for the second clustering.

rescale_path_type_cl2

A string; rescale the hierarchical height of the second clustering by:

  • "max" : the maximum path from the root.

  • "min" : the minimum path form the root.

  • "linkage" : use the linkage distances in the clustering.

ppr_implementation_cl2

Choose a implementation for personalized page-rank calculation for the second clustering:

  • "prpack": use PPR algorithms in igraph.

  • "power_iteration": use power_iteration method.

dist_rescaled_cl2

A logical: if TRUE, the linkage distances of the second clustering are linearly rescaled to be in-between 0 and 1.

row_normalize_cl2

Whether to normalize all rows in the second clustering so they sum to one before calculating ECS. It is recommended to set this to TRUE, which will lead to slightly different ECS values compared to clusim.

Value

Vector of element-centric similarity between the two clusterings for each element.

References

Gates, A. J., Wood, I. B., Hetrick, W. P., & Ahn, Y. Y. (2019). Element-centric clustering comparison unifies overlaps and hierarchy. Scientific reports, 9(1), 1-13. https://doi.org/10.1038/s41598-019-44892-y

Examples

km.res = kmeans(iris[,1:4], centers=8)$cluster
hc.res = hclust(dist(iris[,1:4]))
element_sim_elscore(km.res, hc.res)
#>         1         2         3         4         5         6         7         8 
#> 0.5725739 0.5883689 0.5713929 0.5646983 0.5953591 0.5775034 0.5888063 0.5725739 
#>         9        10        11        12        13        14        15        16 
#> 0.5793498 0.5883689 0.5552506 0.5678591 0.5967179 0.5884860 0.5526488 0.5526488 
#>        17        18        19        20        21        22        23        24 
#> 0.5522368 0.5725739 0.5775034 0.5618324 0.5643404 0.5618324 0.6104780 0.5594834 
#>        25        26        27        28        29        30        31        32 
#> 0.5678591 0.5967179 0.5594834 0.5857504 0.5857504 0.6113811 0.6113811 0.5643404 
#>        33        34        35        36        37        38        39        40 
#> 0.5403762 0.5403762 0.5883689 0.6163701 0.5642079 0.5953591 0.5793498 0.5725739 
#>        41        42        43        44        45        46        47        48 
#> 0.5784556 0.5631405 0.5793214 0.5677370 0.5808829 0.5883689 0.5705257 0.5646983 
#>        49        50        51        52        53        54        55        56 
#> 0.5552506 0.5784556 0.3971228 0.3888342 0.3971228 0.4145138 0.3990188 0.4431152 
#>        57        58        59        60        61        62        63        64 
#> 0.3888342 0.2642398 0.3990188 0.4160351 0.2068583 0.4492832 0.4076366 0.4053566 
#>        65        66        67        68        69        70        71        72 
#> 0.4009317 0.3942835 0.4431152 0.4669962 0.2400096 0.4045893 0.3563649 0.4492832 
#>        73        74        75        76        77        78        79        80 
#> 0.3621665 0.3966004 0.3946250 0.3942835 0.3971972 0.3841961 0.4063244 0.1490502 
#>        81        82        83        84        85        86        87        88 
#> 0.1722459 0.1722459 0.4655941 0.3621747 0.4431152 0.3834688 0.3968295 0.3005642 
#>        89        90        91        92        93        94        95        96 
#> 0.4737055 0.4145138 0.4431152 0.4053566 0.4655941 0.2642398 0.4695627 0.4688420 
#>        97        98        99       100       101       102       103       104 
#> 0.4688420 0.3946250 0.2405771 0.4695627 0.1746209 0.3670500 0.2355955 0.3720433 
#>       105       106       107       108       109       110       111       112 
#> 0.3720433 0.3045653 0.3606773 0.2427842 0.3370849 0.1678165 0.3612985 0.1778436 
#>       113       114       115       116       117       118       119       120 
#> 0.3652728 0.3674982 0.3412419 0.3559829 0.3747542 0.2934328 0.2828210 0.2494739 
#>       121       122       123       124       125       126       127       128 
#> 0.2448791 0.3571895 0.3045653 0.3573927 0.2277836 0.2587716 0.3573927 0.3571808 
#>       129       130       131       132       133       134       135       136 
#> 0.3747542 0.2587716 0.2427842 0.2934328 0.3747542 0.3621747 0.3160663 0.2744339 
#>       137       138       139       140       141       142       143       144 
#> 0.2797074 0.3747542 0.3571808 0.3652728 0.2274133 0.3652728 0.3670500 0.2448791 
#>       145       146       147       148       149       150 
#> 0.2274133 0.3652728 0.3311093 0.3612985 0.2797074 0.3411371