Per-element local concordance between a clustering and a ground truth
Source:R/SpatialMetrics.R
getNeighboringPairConcordance.Rd
Per-element local concordance between a clustering and a ground truth
Usage
getNeighboringPairConcordance(
true,
pred,
location,
k = 20L,
useNegatives = FALSE,
distWeights = TRUE,
BNPARAM = NULL
)
Arguments
- true
A vector of true class labels
- pred
A vector of predicted clusters
- location
A matrix or data.frame with spatial dimensions as columns. Alternatively, a nearest neighbor object as produced by
findKNN
.- k
Approximate number of nearest neighbors to consider
- useNegatives
Logical; whether to include the concordance of negative pairs in the score (default FALSE).
- distWeights
Logical; whether to weight concordance by distance (default TRUE).
- BNPARAM
A BiocNeighbors parameter object to compute kNNs. Ignored unless the input is a matrix or data.frame. If omitted, the Annoy approximation will be used if there are more than 500 elements.
Examples
data(sp_toys)
data <- sp_toys
getNeighboringPairConcordance(data$label, data$p1, data[,c("x", "y")], k=6)
#> [1] 1.0000000 1.0000000 1.0000000 0.7500000 0.2500000 0.5000000 1.0000000
#> [8] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#> [15] 1.0000000 1.0000000 1.0000000 1.0000000 0.6666667 0.3333333 0.6666667
#> [22] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#> [29] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 0.6666667
#> [36] 0.3333333 0.6666667 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#> [43] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#> [50] 0.6666667 0.3333333 0.6666667 1.0000000 1.0000000 1.0000000 1.0000000
#> [57] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#> [64] 1.0000000 1.0000000 0.6666667 0.3333333 0.6666667 1.0000000 1.0000000
#> [71] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#> [78] 1.0000000 1.0000000 1.0000000 0.6666667 0.3333333 0.6666667 1.0000000
#> [85] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#> [92] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 0.6666667 0.3333333
#> [99] 0.6666667 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#> [106] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 0.6666667
#> [113] 0.3333333 0.6666667 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#> [120] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#> [127] 1.0000000 0.6666667 0.3333333 0.6666667 1.0000000 1.0000000 1.0000000
#> [134] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#> [141] 1.0000000 1.0000000 0.6666667 0.3333333 0.6666667 1.0000000 1.0000000
#> [148] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#> [155] 1.0000000 1.0000000 1.0000000 1.0000000 0.6666667 0.3333333 0.6666667
#> [162] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#> [169] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 0.6666667 0.3333333
#> [176] 0.6666667 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#> [183] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#> [190] 0.6666667 0.3333333 0.6666667 1.0000000 1.0000000 1.0000000 1.0000000
#> [197] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#> [204] 1.0000000 0.6666667 0.3333333 0.6666667 1.0000000 1.0000000 1.0000000
#> [211] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#> [218] 1.0000000 1.0000000 1.0000000 0.6666667 0.3333333 0.6666667 1.0000000
#> [225] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
#> [232] 1.0000000 1.0000000 1.0000000 1.0000000 0.5000000 0.2500000 0.7500000
#> [239] 1.0000000 1.0000000