weightedPairsDistance {colordistance} | R Documentation |
Distance between color clusters with user-specified color/size weights
Description
Distance metric with optional user input for specifying how much the bin size similarity and color similarity should be weighted when pairing clusters from different color cluster sets.
Usage
weightedPairsDistance(
T1,
T2,
ordering = FALSE,
size.weight = 0.5,
color.weight = 0.5
)
Arguments
T1 |
Dataframe (especially a dataframe as returned by
|
T2 |
Another dataframe like T1. |
ordering |
Logical. Should clusters by paired in order to minimize overall distance scores or evaluated in the order given? |
size.weight |
Weight of size similarity in determining overall score and ordering (if ordering=T). |
color.weight |
Weight of color similarity in determining overall score and ordering (if ordering=T). Color and size weights do not necessarily have to sum to 1. |
Value
Similarity score based on size and color similarity of each pair of points in provided dataframes.
Note
Use with caution, since weights can easily swing distance scores more
dramatically than might be expected. For example, if size.weight
= 1
and color.weight
= 0, two clusters of identical color but different
sizes would not be compared.
Examples
cluster.list <- colordistance::getKMeansList(system.file("extdata",
"Heliconius/Heliconius_B", package="colordistance"), lower=rep(0.8, 3),
upper=rep(1, 3))
cluster.list <- colordistance::extractClusters(cluster.list, ordering=TRUE)
colordistance:::weightedPairsDistance(cluster.list[[1]], cluster.list[[2]],
size.weight=0.8, color.weight=0.2)