MapBees logoMapBees

Blog

How even: the Shannon diversity index, explained simply

Is the food scene here balanced, or is it one cuisine with a few token exceptions? 'How even' (the Shannon index) answers exactly that, on a 0-1 scale. Here is the formula, and how it differs from 'How mixed', with six cuisines across London.

Formula seriesBeginner friendlyLondon example

Is the mix balanced, or one thing with exceptions?

A street with twenty Italian restaurants and one each of five other cuisines has six kinds. So does a street with a fair spread of all six. Counting kinds says both have six; counting restaurants says both have twenty-five. Neither number sees the difference, and the difference is the whole story.

How even is the number for that. It asks whether the kinds present get a fair slice each, or whether one of them dominates. The field calls it Shannon entropy - borrowed from information theory, where it measures how unpredictable a message is. A perfectly even food scene is maximally unpredictable: you cannot guess the cuisine of the next restaurant. A one-cuisine street is perfectly predictable. MapBees scales it to 0-1 so any set of kinds reads the same way.

How eventhe field's term: Shannon diversity index

How even six cuisines are within a 10-minute walk. Yellow neighbourhoods spread their restaurants fairly across Italian, Indian, Chinese, Thai, Mexican and Lebanese; purple ones are dominated by one.

Switching it on

Exactly as for “How mixed”: open the Map type picker, choose Variety, then tick the kinds you want compared. The Measure as row offers both indices.

Where to click

  1. Map type
  2. Variety
  3. Tick 6 cuisines
  4. Measure as: How even
The same six cuisines, measured as 'How even'. Everything else in the panel is unchanged - only the question asked of the set is different.
'How mixed' and 'How even' are the only two answers this row has. Flip between them and watch which neighbourhoods move - that is the difference between the two formulas, drawn.

Reading the map

The ends read 'One kind dominates' and 'Evenly mixed'. Different words from the Simpson legend on purpose: this index is about evenness, and its labels say so.
Hovering an area gives the index for that neighbourhood, where 1 would be a perfectly even split across all six cuisines.

The maths, honestly

For each kind, multiply its share by the natural log of its share, add those up, and flip the sign. Then divide by the log of the number of kinds you picked, so the result is 0-1 whether you picked four kinds or fourteen. That last division is the part that makes two sets comparable, and it is why the app calls the result normalised.

Two streets, four cuisines each
Street A - one cuisine at 92.5%, three at 2.5%
−Σ p·ln p = 0.35
Divided by ln(4) = 1.386
0.35 ÷ 1.386
Street A - How even
0.25
Street B - four cuisines at 25% each
−Σ p·ln p = 1.386
Street B - How even
1.386 ÷ 1.386 = 1.00

Compare the Simpson results for the same two streets: 0.14 and 0.75. Both agree A is a monoculture and B is varied; Shannon just uses the full 0-1 range and comes down harder on the dominant kind.

Use 'How even' when balance is the point

A food street, a market hall, a mixed-use block: places whose value is that no single kind takes over. Shannon is the stricter judge of that.

Use 'How mixed' when monoculture is the worry

If what you want to avoid is 'all one thing' and a few rare kinds are fine, Simpson's random-pair question matches the way you are thinking.

Both need something to measure

A neighbourhood with none of the six cuisines within reach has no evenness to report, so it shows as “no information” rather than 0. And because a variety index is already a proportion, the Variety map offers no “Count as” row at all - there is no such thing as evenness per resident.

See how even London's cuisines are

The whole idea, in four lines

  • How even = −Σ share × ln(share), divided by ln(number of kinds). That is normalised Shannon entropy, on a 0-1 scale.
  • 1 is a perfectly fair split across every kind you picked; 0 is a single kind. A dominant kind pulls it down hard.
  • It needs a set of two or more kinds, read over a walk so each neighbourhood has enough places to judge.
  • The legend reads 'One kind dominates' to 'Evenly mixed', and areas with none of the kinds show no information rather than 0.
  • Flip 'Measure as' between How even and How mixed to see where the two formulas disagree.

The companion post, How mixed, runs the same six cuisines through the Simpson index.

Quick questions

What does the Shannon index measure?

How evenly the kinds in an area are spread. MapBees scales it to 0-1: 0 means a single kind, 1 means a perfectly even split across every kind you picked. The app calls it 'How even'.

How is 'How even' different from 'How mixed'?

'How mixed' (Simpson) asks how likely two random picks differ; 'How even' (Shannon) asks whether every kind gets a fair slice. Shannon reacts more strongly to one dominant kind, so it is the stricter of the two.

Why is the index divided by ln(K)?

Raw Shannon entropy grows with the number of kinds, so six cuisines could never be compared with four. Dividing by ln(K), where K is the number of kinds you picked, puts every set on the same 0-1 scale.

What does the map show?

Each area is coloured from 'One kind dominates' through 'Somewhat even' to 'Evenly mixed'. Areas with none of the kinds you picked show as having no information, because evenness needs something to be even.

Which should I use for choosing a location?

Use 'How even' when a balanced mix is the point - a food street, a market hall. Use 'How mixed' when you mainly want to avoid monocultures and do not mind a few rare kinds.

See it on a real map

The best way to understand the score is to play with it. The full app is on a free tier, with no sales call.

About the author

Tinkal Gogoi(LinkedIn profile, opens in a new tab)Founder & Location Data Engineer

Builds MapBees's location-intelligence pipeline end to end — census and Overture Maps ingestion, H3 hex scoring, and the map interface — and writes the methodology behind every number on the site.