Ben Collier, PhD Book a call →free, 15 minutes

Heinz College · Public Policy & Management

Machine Learning Foundations with Python

Machine learning in Python for students headed into policy and management work.

A full-semester course at Heinz College that teaches machine learning with Python to students who will apply it to public policy and management problems.

  • Spring 2026
  • Tuesdays and Thursdays, with a Friday recitation
  • Course number 90-803
Slide: Data created worldwide each year keeps climbing, and most of it is never analyzed
Slide: Duolingo daily active users, 2020 to 2024
Slide: The six levels of driving automation, from none to full

slides from the decks
I taught from

Spring 2026 · Tuesdays and Thursdays, with a Friday recitation

Week by week

Scroll the schedule and the slides follow along: five from each session, picked from the decks I taught from.

  1. Part I: Foundations and unsupervised learning
  2. M1Overview of Machine Learning and Analytics in OrganizationsCase: predicting drug price spikes and shortages for a 40-hospital health systemData created worldwide each year keeps climbing, and most of it is never analyzedThe motivating case: a 40-hospital system buying $1.5 billion of drugs a year with a handful of buyersDrug prices are on the rise, and a single price spike can blow a pharmacy budgetBuilding a price spike model from drug, substitute, category, and manufacturer featuresWhat the shipped product claims: 93.8% accuracy on price increases, 76% early detection of shortages
  3. M1Data Exploration and Analysis with PythonOpening puzzle from a quant interview: what is a die roll worth if you can reroll twice?Descriptive, diagnostic, predictive, prescriptive: analytics climbs in value and difficultyA short history of Python, from a hobby project in 1989 to the default language of data scienceTypes of variables: numeric, categorical, ordinal, binary, and datesGroup by and aggregate: the pandas move behind most business questions
  4. M1Recitation: Data Sourcing, Cleaning, and VisualizationIn-class exerciseFlat files: the same data as CSV, JSON, and ExcelHow an API works: your code asks a server, the server answers with dataMarket data APIs like Alpha Vantage put live prices one request awayData professionals spend as much as 80% of their time cleaning and organizing dataThe Python visualization libraries, from Matplotlib to Plotly
  5. M2Unsupervised Learning: ClusteringClustering project kicks off: segmenting credit card customersPlain, spicy, extra chunky: Howard Moskowitz found segments where others saw one marketClustering for policy: finding eligible households that never enroll in SNAP or MedicaidK-means in four steps: place centroids, assign points, recompute, repeatThe elbow method: add clusters until the error stops falling fastSame rings, two algorithms: k-means cuts them into wedges, DBSCAN follows the shape
  6. M3Factor Reduction and Feature EngineeringThe Hughes phenomenon: past some point, more features make a classifier worseSeventeen foods across four UK nations. Which country is the odd one out?A principal component is a direction in the 17-dimensional space of food typesSqueezing square footage and number of rooms onto one line of best fitFeature engineering: imputation, outliers, one-hot encoding, log transforms, scaling
  7. Part II: Supervised learning
  8. M4Regression Theory and MethodsInference versus prediction: explaining the world or forecasting itA policy regression: do workforce training programs raise earnings after six months?The assumptions of linear regression, and what breaks when each one failsA decision tree splits movies into hits and flops on stars and budgetFrom one tree to many: bagging builds random forests, boosting builds gradient boosted trees
  9. M5Classification Theory and Methods, with a guest lecture on machine learning for product data scienceGuest lecture from a CMU alum working as a product data scientist; lab on telco customer churn
  10. M6Model Evaluation and Hyperparameter TuningAmazon's resume screener learned to penalize the word women's. What went wrong?Generalization: training error keeps falling while test error turns back upThe ROC curve: every threshold traded off between catching positives and false alarmsLIME on a wolf-versus-husky classifier: the model was looking at the snowSHAP values: how much each feature pushed a mushroom toward poisonous
  11. M7Forecasting with Time Series DataU.S. retail sales: a steady trend with a holiday spike every yearRandom noise, trends, and seasonality: the patterns a forecast has to separateDuolingo daily active users, 2020 to 2024Google's stock price after differencing: the trend is gone, the noise remainsProphet decomposes a series into trend, seasonality, and holidays
  12. No class: spring breakNo class
  13. Part III: Experiments, language, and vision
  14. M8A/B Testing and Multi-Armed BanditsNo class Tuesday. Case: game design at Cookie Cats. Midterm projects due March 15An A/B test: split the audience, show each half a version, compare conversionHow sad should Duo be? Even a mascot's expression is something you can testDropping capitalization looked harmless and cost 0.5% of day-one retentionCookie Cats moved the first gate from level 40 to level 30. Did players stay longer?Bandits: an A/B test that shifts traffic to the winner while it is still running
  15. M9Natural Language Processing Theory and MethodsStructured versus unstructured data, and why most of an organization's data is textEnglish is 59% of web content but is spoken by about 20% of the worldStemming versus lemmatization: two ways to reduce words to their rootsWord embeddings place words with similar meanings near each otherClassical NLP pipelines gave way to deep learning in about five years
  16. M10Neural Network FundamentalsFrom a biological neuron to an artificial one: weighted inputs and an activationA handwritten digit is 784 pixels, each an activation between 0 and 1The hope for hidden layers: digits built from loops and strokesA single neuron can learn OR and AND, but not every patternForward propagation makes a prediction, backpropagation assigns the blame
  17. M11Large Language ModelsPretraining is like compressing a chunk of the internet into a file of weightsAt bottom, a language model predicts the next wordHow to train a chatbot: pretrain a base model, then fine-tune it into an assistantScaling laws: loss falls predictably with more parameters and more dataIn one clinical study, the LLM alone beat doctors using conventional resources on diagnostic reasoning
  18. M12Text Mining with Large Language ModelsIn-class exerciseLab week, short for Spring Carnival. Language model project due: routing student loan complaints
  19. M13Computer Vision FundamentalsCheXNet: detecting pneumonia from chest X-rays at the level of radiologistsObject detection: boxing every car and person on a busy streetAdd a little noise and a panda becomes a gibbon at 99% confidenceImageNet error rates fell below the 5.1% human benchmarkA vertical edge detection kernel, the basic move inside a convolutional network
  20. M14Case: Tesla Vision vs. Waymo Sensor Fusion, and course wrap-upCaseComputer vision project due. Final projects due April 30The six levels of driving automation, from none to fullWaymo: 29 cameras, 5 lidar, 6 radar. Tesla: 9 cameras and vision aloneHow a self-driving car sees: cameras, short and long range radar, and lidarThe toolkit built over the semester, from k-means to transformers

Method

How the course works

Every method is framed as a policy question: which households in a broadband subsidy program are about to drop out, how to route thousands of student loan complaints, whether a language model and a person agree on how serious a complaint is. In the language model project, students have a model sort complaints into six policy categories and measure its agreement with other models using Cohen's kappa.

Instead of one end-of-term project, students do four applied projects across the semester (clustering, classification, language models, and computer vision), a midterm project for a public agency or nonprofit, and a final project with a three- to five-minute pitch. A CMU alum working as a product data scientist gave a guest lecture on machine learning for product decisions.

Seventeen foods across four UK nations. Which country is the odd one out?
fig. 1 · Seventeen foods across four UK nations. Which country is the odd one out?

What students hand in

Major assignments

  • In-class exercises and participation20%
  • Quizzes20%
  • Mini-labs10%
  • Applied ML projects30%
  • Midterm project10%
  • Final project10%
fig. 2 · weight of each major assignment in the grade

In-class exercises and participation 20%

Lecture days end with a short two or three question quiz on Canvas. Lab days end with submitting the code we wrote together, graded pass/fail.

Quizzes 20%

Weekly open-book quizzes on Canvas covering lectures and readings, about 15 to 20 minutes each, with the two lowest scores dropped. No generative AI on quizzes.

Mini-labs 10%

Short individual labs of one to two hours, graded on completion, each starting from a notebook. Topics include avocado prices and sales across U.S. markets, feature engineering and PCA on a 70-column real estate dataset, random forests predicting home sale prices, predicting which households drop out of a subsidized broadband program, and NLP on CFPB student loan complaints.

Applied ML projects 30%

Four projects in groups of up to three, graded the way a professional deliverable would be. Clustering segments credit card customers with k-means and at least two methods for choosing the number of clusters. Classification models customer retention at a student travel company. The language model project has a model reclassify student loan complaints into six policy categories, check agreement between models with Cohen's kappa, and test whether models can score complaint severity. The last project applies computer vision.

Midterm project 10%

Groups pick a decision problem for a public agency, nonprofit, or mission-driven organization and answer it with clustering, regression, or classification. Deliverables are an 8 to 12 page paper and a short presentation at the start of a class in the second half of the term.

Final project 10%

A policy question of the group's own, or one I define (legislative text, public comment sentiment, satellite imagery), answered with NLP, neural networks, language models, or vision. Deliverables are a one-page proposal, a 5 to 10 page report, and a 3 to 5 minute pitch on the last day of class.

In their words

What students say

4.80 out of 5 average teaching rating · 1 section · 40 student responses · all evaluations

Dr. Collier made me actually care about this course. I was not excited about it and felt like it was going to be massively over my head.

Spring 2026

One of the best courses I have taken at Heinz. He does a wonderful job of explaining ML topics to technical and non-technical students alike.

Spring 2026

Thank you for making this class project based, which helps me prove to my future employer that I can actually use these skills.

Spring 2026

I LOVE THIS COURSE, PLEASE STAY IN THIS COURSE

Spring 2026

Revision history

How the course developed

I took over this Heinz College course in Spring 2026 and rebuilt it as fourteen modules, each pairing a lecture with a lab. It runs from clustering and regression through A/B testing to language models and computer vision. It ends with a teaching case I wrote comparing Tesla's camera-only approach to self-driving with Waymo's sensor fusion.

Offerings

  • Spring 2026 full-time

Heinz students get the full materials on Canvas.

All courses