Every tutorial can be read here with its code and output. Download the R Markdown labs to run them in RStudio, or open the Python notebooks in Google Colab to run your own copy in the browser, with nothing to install. Use the search box in the sidebar to find a function or topic across all tutorials.
Network analysis in R
Descriptive network measures
Degree, in- and out-degree, closeness, betweenness and eigenvector centrality in an international diplomacy network, and how the measures correlate.
Network visualization
Visualizing networks for readers who don’t know the data, using prisoner friendship, needle-sharing and other networks.
Both labs use the Comparative Networks Dataset (McMillan, Phadke, Goist, & Denny, 2017), which is shared with enrolled students on Canvas.
Images and text in Python
Visual feature extraction
How a computer turns an image into keypoints, feature vectors and clustered “visual words,” the building blocks of bag-of-visual-words analysis.
Facial emotion analysis with DeepFace
Detecting faces and their dominant emotions in YouTube video thumbnails, then turning the emotion scores into variables for analysis.
Fine-tuning BERT for classification
Fine-tuning DistilBERT with Hugging Face transformers to predict a book’s genre from its Goodreads reviews, from train/test split to evaluation.
Credits
The BERT tutorial is adapted from the AI for Humanists tutorial “Training and Fine-Tuning BERT for Classification” by Maria Antoniak, Melanie Walsh, and David Mimno.