Excellent question — you’re comparing two ranking/splitting methods that group items into ordered bins (say, 3 vs. 10 levels), and you want to quantify how similar their outputs are.
Here’s how to think about it and which metrics might make sense depending on your setup:
🧩 1. Nature of the data
Let’s assume:
You have NNN items.
Method A assigns each item to one of kA=3k_A = 3kA=3 bins.
Method B assigns each item to one of kB=10k_B = 10kB=10 bins.
Both are ordered categories — e.g., bin 1 < bin 2 < bin 3, etc.
So this is ordinal rather than nominal data.
🧮 2. Metrics for comparing ordinal rankings/splits
(a) Spearman’s rank correlation (ρ)
Treat each bin assignment as a numeric rank.
Compute Spearman’s ρ between the two methods’ outputs.
Pros: Simple, captures monotonic agreement.
Cons: Works best when both methods have similar granularity.
If your bins are uneven (e.g., 3 vs. 10), you can assign each item the midpoint of its bin and still use Spearman’s ρ.
(b) Kendall’s τ (tau)
Measures how often pairs of items are ordered the same way between two rankings.
Pros: More interpretable (fraction of pairwise agreement).
Cons: Computationally heavier for large N, but excellent for rank agreement.
(c) Weighted Kappa (Cohen’s κ or Quadratic Weighted Kappa)
Designed for ordinal classification.
Takes into account that disagreement between bin 1 and bin 2 is less severe than between 1 and 10.
Common in grading tasks (e.g., comparing human vs. machine scores).
Use Quadratic Weighted Kappa (QWK) — it’s ideal for comparing ordered categorical labels with different granularities.
(d) Mutual Information (MI) or Normalized MI
Measures how much information one labeling tells you about the other.
Doesn’t require same number of bins.
But ignores order — treats them as nominal categories.
If order is less important to you, MI or Adjusted Mutual Information (AMI) are solid choices.
(e) Earth Mover’s Distance (EMD) / Wasserstein distance
Measures how far one distribution over bins is from another, considering the order of bins.
Works especially well if you’re comparing overall distributions rather than per-item matches.
Example: if both methods roughly agree that most items are “middle” but differ slightly in thresholds.
🧭 Summary: Metric choice guide
GoalGood metricNotesCompare overall rank orderSpearman’s ρ or Kendall’s τUse if bins represent ranksCompare ordered bins with unequal granularityQuadratic Weighted KappaBest for 3 vs. 10 binsCompare categorical similarity, ignoring orderAdjusted Mutual InformationOrder-agnosticCompare bin distributionsEarth Mover’s DistanceDistribution-level comparison
⚙️ Example Workflow
If you have per-item bin assignments:
pythonCopiar códigofrom scipy.stats import spearmanr, kendalltau
from sklearn.metrics import cohen_kappa_score, normalized_mutual_info_score
import numpy as np
Example
bins_3 = np.array([1,2,1,3,2,2,1,3])
bins_10 = np.array([2,7,3,10,5,6,4,9])
Spearman correlation
spearmanr(bins_3, bins_10)
Kendall’s tau
kendalltau(bins_3, bins_10)
Quadratic weighted kappa
cohen_kappa_score(bins_3, bins_10, weights='quadratic')
Normalized mutual information
normalized_mutual_info_score(bins_3, bins_10)
Would you like me to tailor this further — for example, are your “bins” based on continuous score thresholds (e.g. quantiles), or are they categorical groupings (like “low/mid/high”)?
That affects which metric is most meaningful.