LUIGI Curini
  • Home
  • CV & Interests
  • Courses
    • 2026/27 >
      • Scienza Politica
      • Text Analytics
  • Publications
    • Scientific Publications
    • Articles on press OP/EDS
    • Interviews
  • Personal
  • News
  • Home
  • CV & Interests
  • Courses
    • 2026/27 >
      • Scienza Politica
      • Text Analytics
  • Publications
    • Scientific Publications
    • Articles on press OP/EDS
    • Interviews
  • Personal
  • News
Picture
Picture


Text analytics, machine learning and large language models (Module 1) (first term 2026/27)

Course summary
This module of the course aims to provide students with both theoretical and practical knowledge of contemporary text analytics, machine learning techniques, neural network architectures, and Large Language Models (LLMs), with particular attention to their applications in Computational Social Science. Students will be introduced to the evolution of computational approaches to text analysis, from traditional bag-of-words representations and topic modelling techniques to advanced embedding methods and Transformer-based architectures that underpin contemporary LLMs.  Particular emphasis will be placed on practical experimentation through programming activities in R. ​

Course evaluation
One home-assignment (every two weeks): 5 in total. Plus an oral exam at the end of the course (on Thursday 26 November – 12:30-15:30)

​First Lecture 
17/09/26, 12:30-14:30 Theory: An introduction to text analytics: the Bag-of-Words approach 
Reference texts:  (1; 2)
  • ​Grimmer, Justin, and Stewart, Brandon M. 2013. Text as Data: The Promise and Pitfalls of Automatic Content Analysis Methods for Political Texts. Political Analysis, 21(3): 267-297
  • Benoit, Kenneth (2020). Text as data: An overview. In Luigi Curini and Robert Franzese (eds.), SAGE Handbook of Research Methods is Political Science & International Relations, London, Sage, chapter 26 ​

​18/09/26, 10:30-12:30 Lab class: An introduction to the Quanteda package​. a) packages to install for Lab 1; b) Script for Lab 1 - R script; Google Colab notebook; datasets: a) Boston tweets sample (.csv; .rds); b) Inaugural US Presidential speeches sample (to open this file, please use the data compression tool WinRAR); EXTRA: How to open files stored in your Google Drive on Google Colab

​Second Lecture 
24/09/26, 12:30-14:30 Theory: Unsupervised classification methods: the Topic Model (and beyond)
Reference text (1; 2):
  • ​Grimmer, Justin, and Stewart, Brandon M. 2013. Text as Data: The Promise and Pitfalls of Automatic Content Analysis Methods for Political Texts. Political Analysis, 21(3): 267-297
  • ​Robert, Margaret E., Brandon M. Stewart, Dustin Tingley, Christopher Luca, Jetson Leder-Luis, Shana Kushner Gadarian, Bethany Albertson, David G. Rand. 2014. Structural Topic Models for Open-Ended Survey Response. American Journal of Political Science, 58(4), 1064-1082

​25/09/26, 10:30-12:30 Lab class: How to implement a Topic Model and a Structural Topic Model. a) packages to install for Lab 2; b) script for Lab 2 - R script; Google Colab notebook; dataset: NyT economic articles (.rds); c) data for topical content analysis; d) dataset of the searchK exploration. EXTRA 1: investigating the best alpha and delta combination; EXTRA 2: computing FREX statistics in topicmodels; EXTRA 3: how to use a trained topic model with a new test-set; EXTRA 4: how STM computes a topical content graph
​
First assignment (due: 3o September 2026) (dataset for the first part: dataset about lyrics of songs; dataset for the second part: Guardian 2016 (.csv; .rds); dataset for the third part: Trump 2018 tweets). Note: to open a .rds file, use the command readRDS("NAME OF THE FILE.rds")

​Third Lecture 
01/10/26, 12:30-14:30 Theory: (part 1):  An introduction to supervised classification models; (part 2): Supervised classification models: Naïve Bayes models; (part 3): The importance of a good training set
Reference text (1; 2; 3, 4):
  • Olivella, Santiago, and Shoub Kelsey (2020). Machine Learning in Political Science: Supervised Learning Models. In Luigi Curini and Robert Franzese (eds.), SAGE Handbook of Research Methods is Political Science & International Relations, London, Sage, chapter 56  
  • Grimmer, Justin, and Stewart, Brandon M. 2013. Text as Data: The Promise and Pitfalls of Automatic Content Analysis Methods for Political Texts. Political Analysis, 21(3): 267-297
  • Curini, Luigi, and Robert Fahey. 2020. Sentiment Analysis. In: Luigi Curini and Robert Franzese (eds.), Sage Handbook of Research Methods in Political Science and International Relations, London: Sage, chapter 29
  • Barberá, Pablo et al. (2020). Automated Text Classification of News Articles: A Practical Guide. Political Analysis, DOI: 10.1017/pan.2020​

​02/10/26, 10:30-12:30  Lab class: How to implement a NB model and running an inter-coder reliability test. a) packages to install for Lab 3; b) (part 1): script for Lab 3 - R script; Google Colab notebook; (part 2): R script; datasets for Lab 3: a) disaster dataset - training-set (.csv; .rds); b) disaster dataset - test-set (.csv; .rds); c) US airlines training-set (.csv; .rds); d) US airlines test-set (.csv; .rds);  EXTRA: Meaning of a compressed sparse matrix 

Fourth Lecture
08/10/26, 12:30-14:30 Theory: Supervised classification models: Random Forest & Regularized Regression

Reference text (1):
  • Olivella, Santiago, and Shoub Kelsey (2020). Machine Learning in Political Science: Supervised Learning Models. In Luigi Curini and Robert Franzese (eds.), SAGE Handbook of Research Methods is Political Science & International Relations, London, Sage, chapter 56  

​09/10/26, 10:30-12:30  Lab class: How to implement supervised classification model: RF & RR. a) packages to install for Lab 4; b) script for Lab 4 - R script; Google Colab notebook; EXTRA: How to use KERAS3 in Google Colab

Second assignment (due: 21 October 2026) 
Proudly powered by Weebly