I have a data set of 200k observations of about 75 variables representing people in about 60 distinct jurisdictions. I am trying to figure out which jurisdictions are most similar to each other on the basis of say 4-10 different demographic variables (all continuous). Essentially, what I am trying to do is pick two jurisdictions that are as similar as possible in one but very different with regard to a specific variable (per-child funding in a specific grant). Once I figure out which districts are most similar, I can just check the pairs to see which are disparate in funding.

I checked this post, but it doesn't seem to apply.

How can I quantitatively determine just how similar two groups are? Bonus if there's a scikit-learn library that handles it...

  • $\begingroup$ Any single similarity score would be some sort of aggregation/comparison between the observation pairs. scikit-learn has several Pairwise metrics. $\endgroup$
    – rickhg12hs
    Nov 9, 2022 at 3:55
  • $\begingroup$ Thanks @rickhg. Would pairwise options work if the districts do not contain the same number of observations? $\endgroup$
    – pubb
    Nov 9, 2022 at 23:33
  • $\begingroup$ I believe most, if not all, of the scikit-learn pairwise metrics require equal number of observations. $\endgroup$
    – rickhg12hs
    Nov 10, 2022 at 0:26


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.