Session 7: Working with AI in the Data Science Workflow

Published

09 11 2026

Modified

16 10 2026

Note

Monday, 9 November 2026, 09:00–11:15 · Room MAD 099

ImportantBring a free AI chat assistant

Any one you like, open in your browser. You use it in the exercise. Nothing to install in R.

What this session is about

Since session 1 the rule has been: use AI freely — the exam included — and you are responsible for every line you hand in. Today is about making the two ingredients to that sentence — use AI and check AI — work.

An AI assistant is very good at the part of data science you found hardest at the start of this course: remembering the syntax. It is no good at the parts you spent sessions 1 to 6 learning: which rows belong in the analysis, which summary is right, what a chart should claim, and whether it misleads. It has not seen your data by default. It (often) does not run its own code. And it sounds exactly as confident when it is wrong as when it is right.

The session follows four competencies from the AI Fluency framework (Anthropic n.d.), one part each:

  • Delegation — what to hand over. Three ways to work with AI — automation, augmentation, agency. What a chat assistant and an agent can and cannot know, which parts of the work to give them, and which to keep.
  • Description — saying what you need. A prompt that carries what you know — the data, the rows, the mapping sentence, the style — so that the code it returns is the code you wanted.
  • Discernment — is it any good? Numbers it never computed, code that crashes, and the dangerous case: code that runs and is wrong. A five-step routine for catching it, and the session 6 checklist for every chart.
  • Diligence — taking responsibility. What not to paste, and how to declare what you did.

Learning goals

  • Say what a chat assistant can and cannot know about your data and code
  • Decide what to delegate to an assistant and what to keep
  • Write a prompt that specifies the data, the rows, the summary and the chart
  • Recognise a number or a claim the assistant did not compute
  • Use an assistant to explain an error message — and judge its suggestion
  • Check AI-written code with a five-step routine: run, n, recompute, checklist, read
  • Write an AI declaration that says what you checked

Slides

The slides appear here after the session.

Everything you need for the session is already below.

Materials

File Description
Exercise sheet The in-session exercise
ai-analysis.qmd An “AI-written” analysis with six planted errors — for Part B
hotels-europe_price.csv Prices — as in sessions 5 and 6
hotels-europe_features.csv Features — as in sessions 5 and 6
Slides Online after the session
Live coding document Online after the session
Exemplary solution Online after the session

Data

The Hotels in Europe data for the third session in a row — on purpose. You know its traps by now: the four-night stays, the hotels in the suburbs, the half stars. An assistant does not, and that is today’s point.

Békés and Kézdi (2021), licensed CC BY-NC-SA 4.0. Unmodified.

This document was written for this course, in the style of an answer from an AI chat assistant. Six errors are planted in it on purpose. Each is one that real assistants make. Every chunk runs, and every number it prints is computed correctly from the data it was given — which is exactly what makes the errors hard to see.

The question we answer

When an AI assistant writes the code, what is left for you to do — and how do you do it?

Almost everything. The assistant does the typing. You decide which rows belong in the analysis, which summary is right and what the chart should say — and you write those decisions into the prompt. Then you check what comes back, because the most dangerous answers are the ones that run without an error.

The most useful single habit: never let an assistant write a number it has not computed. That covers a title, a sentence in a report and a figure in an e-mail.

Take-home until session 8

Important

Work through AI Fluency: Framework & Foundations on Anthropic Academy (Anthropic n.d.) — free, about three to four hours: https://anthropic.skilljar.com/ai-fluency-framework-foundations

Today we went through each of the four Ds once, on hotel data. The course takes each of them further.

Session 8 moves from explaining to predicting: why the model that best describes your data is not the model that best predicts new data. Feedback on Report 2 comes there too.

Going further

References

Anthropic (n.d.) AI fluency: Framework & foundations, available at https://anthropic.skilljar.com/ai-fluency-framework-foundations (accessed October 2026).
Békés, G. and Kézdi, G. (2021) Data analysis for business, economics, and policy, Cambridge: Cambridge University Press, available at https://gabors-data-analysis.com/.