Data Science2024

Shipped

Game of Thrones — Survival Analytics

Who lives, who dies, and why: statistical survival analysis across Westeros.

  • Censoring-aware statistics
  • Multi-source data reconciliation
  • Stats made narratively compelling
Sources
3 linked datasets
Battles
War of the Five Kings
Models
XGBoost + statsmodels
Framing
Censoring-aware survival

01

Overview

George R. R. Martin kills characters the way other authors write weather, which makes Westeros a legitimate survival-analysis problem. Working from three community datasets — the battles of the War of the Five Kings, the ledger of character deaths, and crowd-modelled survival predictions — this project explores what actually correlates with dying in Game of Thrones, then builds models to predict who makes it.

02

Problem

The fun question ("who dies next?") hides a serious methodological one: survival data is censored — characters still alive are not evidence of immortality, only of not having died yet. Treating that correctly, on a dataset assembled by fans from books, is a compact course in careful modeling on imperfect real-world data.

03

Goals

  • Chart the war itself — attacker vs defender outcomes, battle sizes, commander records, regional patterns
  • Find the mortality gradients: house, gender, nobility, and book-by-book death rates
  • Model survival probability per character and compare against the community predictions dataset

04

Solution

Battle EDA reconstructs the military history from battles.csv: who attacks, who wins, how outcomes shift with army size and battle type — visualised as outcome matrices and regional maps of the conflict.

The mortality analysis joins character-deaths with allegiances and status to expose the gradients everyone suspects (being named early, being noble, swearing the wrong allegiance) and quantify them properly.

Prediction uses gradient boosting (XGBoost) and statsmodels alongside the character-predictions dataset, with attention to class imbalance and to keeping evaluation honest about what the model can and cannot know.

05

Research

Builds on the community lineage of Thrones data science: Chris Albon's War of the Five Kings dataset, the Bayesian survival analysis of Erin Pierce and Ben Kahle, and the A Song of Ice and Data project's machine-learning predictions.

Tooling

Tech stack

  • Python
  • pandas
  • seaborn
  • plotly
  • XGBoost
  • scikit-learn
  • statsmodels
  • Jupyter

Friction

Challenges

Censored outcomes

Alive-so-far is not the same label as safe. The analysis had to frame survival carefully — mixing death indicators with time-at-risk — to avoid the classic beginner mistake of classifying on a moving target.

Fan-assembled data

These tables were transcribed from novels by volunteers; names conflict, allegiances shift, fields go missing. A substantial cleaning pass, cross-referencing the three files, precedes every result.

Takeaways

Lessons learned

  • Survival analysis is its own discipline — naive classification on who-died data quietly answers the wrong question
  • Cross-referencing multiple imperfect sources beats trusting any single clean-looking one
  • Narrative datasets recruit readers into statistics better than any business dataset ever will

Evidence

Dataset

Game of Thrones datasets (battles, deaths, predictions)

Kaggle — community-assembled from the books

Three linked tables: 38 recorded battles of the War of the Five Kings, character death records with allegiances, and modelled survival predictions per character.

View dataset

Roadmap

Future improvements

  • Character co-occurrence network to test whether social connectivity predicts survival
  • Proper Kaplan-Meier curves by house and allegiance
  • Extend to show-timeline data for book-vs-show mortality comparison

Rebuilt for this site from the original repository — source history