NLP

Jaccard Similarity — A Simple Example


For a given term (say fraud) in a given year, you have two separately-trained Word2Vec models — one on Democrat emails, one on Republican emails. From each you pull the top-10 nearest-neighbor words to fraud. Jaccard asks: how much do those two neighbor lists overlap?

Notice the similarity scores are thrown away — only the words matter (ww for w,sw, s in ...). It's purely set membership: is a word in both top-10 lists or not.

J=DemRepDemRep=words in both liststotal distinct words across both listsJ = \frac{|\text{Dem} \cap \text{Rep}|}{|\text{Dem} \cup \text{Rep}|} = \frac{\text{words in both lists}}{\text{total distinct words across both lists}}

Simple example

Say for fraud in 2020, with k=10k=10:

PartyTop-10 neighbors of fraud
Democrat voter, suppression, myth, baseless, claims, debunked, false, gop, lie, disinformation
Republican voter, ballot, illegal, dead, mail, cheating, stolen, rigged, machines, claims

Now compare the sets:

  1. Intersection (in both) voter, claims → 2 words
  2. Union (in either, counted once) the 10 Dem + 10 Rep minus the 2 shared = 18 words
J=218=0.11J = \frac{2}{18} = 0.11

How to read it

  1. 1.0
    J=1.0J = 1.0 → identical neighbor lists. Both parties surround the word with the same associations → convergence / shared meaning.
  2. 0.0
    J=0.0J = 0.0 → zero shared neighbors. The parties embed the word in completely different contexts → maximum divergence / polarization.
  3. 0.11
    The example's 0.110.11 says Dem and Rep talk about "fraud" in largely different terms — Democrats frame it around debunking/suppression, Republicans around mechanisms of alleged cheating.
A discrete ladder Since both lists always have 10 words, the union ranges from 10 (identical) to 20 (nothing shared), so with k=10k=10 the possible Jaccard values are a discrete ladder: 020, 119, 218, 317, , 1010\tfrac{0}{20},\ \tfrac{1}{19},\ \tfrac{2}{18},\ \tfrac{3}{17},\ \ldots,\ \tfrac{10}{10} 0, 0.05, 0.11, 0.18, , 1.0\approx 0,\ 0.05,\ 0.11,\ 0.18,\ \ldots,\ 1.0. That's why the low values on your plot cluster around 0–0.18 rather than varying continuously.