Data science · Cultural anthropology · Python

ML Applications in Anthropology

What do societies farm, hunt and believe? Two projects use maps and machine learning to look for patterns in 141 societies.

A herd of cows
141 societiesStandard Cross-Cultural Sample

01 Two tools, one question

This project started in an anthropology course that treats culture as data. The question: where do food taboos come from? Pigs are taboo in Judaism and Islam. Do societies that keep pigs have different gods, hunting habits and religions from societies that keep other animals?

To look for an answer, I built two small Python tools. One maps the data. The other clusters it with machine learning.

141societies in the Standard Cross-Cultural Sample
118societies with map coordinates
7kinds of primary domesticated animal
3clusters found with K-Modes

1. Domesticated animals map

Every society gets an icon for its main domesticated animal. Click an icon to read about the gods, hunting and religion of that society.

Open the map →

2. Clustering demo

The K-Modes algorithm groups societies with similar animals, gods and religion. Charts and a map show what each group has in common.

See the clusters →

02 141 societies, four categorical variables

The data comes from D-PLACE, a database of cultural data. Locations come from Glottolog. Every variable is a category, not a number. This is why the clustering uses K-Modes.

VariableWhat it describesExample values
domesticated_labelThe main domesticated animalPigs, Bovines, Camels, Small Species
roleofgods_labelThe role of the godsAbsent, Otiose, Active (supporting morality)
animalshunted_labelThe animals that people huntLarge Game, Small Mammals, Birds or Waterfowl
religion_labelThe main religionIndigenous religion, Islamization, Christianization
focal_yearThe year that the data describes1880

23 societies have no coordinates. They appear in the clustering but not on the maps.

03 Map of primary domesticated animals

Hover over an icon to see the society. Click it to see the focal year, the role of the gods, the animals hunted and the religion.

Interactive map. Open full screen
  • Small species
  • Pigs
  • Ovis
  • Equines
  • Reindeer
  • Camels
  • Bovines

How it works

pandas joins the society data to the coordinates. Folium draws one marker for each society. Branca adds the legend. The script is map.py.

04 Clustering societies with K-Modes

Clustering puts similar items in the same group. K-Modes is like K-Means, but it works with categories. The center of a group is the most common category of each variable.

Black = cluster 1, green = cluster 2, red = cluster 3. Open full screen

What each cluster has in common

69

Cluster 1 · Black

  • Gods are absent (50 societies)
  • Pigs are the main animal in 23 of the 24 pig societies
47

Cluster 2 · Green

  • Gods are otiose (27)
  • Small animals are the main animal (31)
  • People hunt two or more kinds of animal (26)
25

Cluster 3 · Red

  • Gods are active and support morality (22)
  • Deep Islamization is common (14)
  • Bovines (17) and camels (3) are the main animals
The finding I find most interesting: almost all pig societies are in the cluster where gods are absent. Pigs are taboo in Judaism and Islam. This may support a link between food taboos and the role of gods. Correlation is not causation, and geography and indigenous religions also shape the clusters.

The elbow curve has no sharp bend, so 3 clusters is a readable choice and not a proof. A fixed seed (SEED = 42) makes each run give the same result.

Charts

The charts and map from the original 2021 analysis are in the repository. Its random start was different, so the cluster sizes differ a little. The main pattern is the same.

05 Run the projects yourself

You need Python 3.9 or later.

git clone https://github.com/briannarimm/ml-applications-in-anthropology.git
cd ml-applications-in-anthropology
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

python domesticated-animals-map/map.py   # writes the animal map
python clustering-demo/clustering.py     # writes charts, CSV files and the cluster map

python -m http.server 8000               # open http://localhost:8000

To use your own data, change the CSV files in data/. Keep the column names. To change the number of clusters, change N_CLUSTERS in clustering.py.

06 Sources and thanks

  • Data: D-PLACE (Murdock & Morrow 1970; Murdock 1962–1971 and Gray 1999; Rosenblatt, Walsh & Jackson 2011) and Glottolog 4.4.
  • Icons: Symbolon, BomSymbols, Doodle Icons and KonKapp from the Noun Project (CC BY 3.0).
  • Header images: Pixel-Sepp and Pexels on Pixabay.
  • Software: Folium, Branca, pandas, kmodes, seaborn and Matplotlib.

Full citations are in CREDITS.md.