Reproducible Pipeline for Large-scale Data Analysis
Wei Ai University of Maryland
ISEA Training Program — April 24, 2026
Slides prepared with the help of Cursor / Claude Opus 4.6
Motivation
So, You Did Some Data Science…
You have a trained model, a beautiful dashboard, or an insightful report.
But behind the polished result…
Can someone else (or future you) reproduce it?
Why Reproducibility and Reliability Matter
Other people will thank you.
Collaborate more easily — your teammate can pick up where you left off
Learn from your analysis about the process and the domain
Feel confident in the conclusions at which the analysis arrives
You will thank yourself.
Which notebook should I run first?
Where to go if I need to add one more column?
What if the questions are asked 4 years later?
Managing a Data Science Project
Manage data — data pipeline as a DAG
Manage code — notebooks vs. scripts
Manage project — version control, documentation
Manage collaboration — issues, code review
Managing Data
Rethink the Plumbing: Data Pipeline as a DAG
flowchart LR
A["Survey Data<br>(raw, immutable)"] --> D["Clean &<br>Merge"]
B["Admin Records<br>(raw, immutable)"] --> D
C["External Data<br>(census, weather)"] --> D
D --> E["Feature<br>Engineering"]
E --> F["Model"]
E --> G["Summary Stats<br>& EDA"]
F --> H["Evaluation"]
F --> I["Paper /<br>Report"]
G --> I
H --> I
H --> J["Dashboard"]
style A fill:#e8f4f8,stroke:#1d3557
style B fill:#e8f4f8,stroke:#1d3557
style C fill:#e8f4f8,stroke:#1d3557
style I fill:#fef0ed,stroke:#e63946
style J fill:#fef0ed,stroke:#e63946
Each step is a node; data flows forward through edges — this is a graph, not just a pipeline
You can trace backwards from any output to the code and data that created it
Raw data must be treated as immutable — read and copy, never modify in place
Cookiecutter Data Science
A well-known open-source project template by DrivenData:
├── data│ ├── external ← Data from third party sources│ ├── interim ← Intermediate data that has been transformed│ ├── processed ← Final, canonical data sets for modeling│ └── raw ← The original, immutable data dump│├── models ← Trained models, predictions, summaries├── notebooks ← Jupyter notebooks (exploration only)├── reports ← Generated analysis (HTML, PDF, LaTeX)│ └── figures ← Generated graphics and figures│├── src/ ← Source code for use in this project│ ├── dataset.py ← Scripts to download or generate data│ ├── features.py ← Code to create features for modeling│ ├── modeling/ ← Code to train and predict│ └── plots.py ← Code to create visualizations│├── README.md ← What this project does and how to run it├── requirements.txt ← Dependencies for reproducing the environment└── Makefile ← Convenience commands (make data, make train)
The Data Directory Structure
data/├── external/ ← Third party data (census, weather, etc.)├── interim/ ← Intermediate transformations├── processed/ ← Clean data ready for modeling└── raw/ ← NEVER modify these files
Most data should not be kept in version control
Use .gitignore to specify files not tracked by git
Small and stable data files are fine (e.g., a zipcode-city lookup)
Large or sensitive data → store externally (S3, GCS, shared drive) with a download script in your repo
Execution counts, outputs, metadata — all embedded. This is why git diff on a notebook is unreadable: one line of code change → dozens of lines of noise.
Refactor Code from .ipynb to .py
Consciously extract common building blocks from notebooks into .py files
Prevents duplication of code across multiple notebooks
Separates concerns into logical units:
Data layer (ETL code) → modeling → output layer
Make sure each notebook is always correct if “Restart & Run All”
Use naming conventions for ordering and ownership:
e.g., step01-<initials>-<description>.ipynb
e.g., 3.1-awei-extract-audio-features.ipynb
Pseudo-Notebooks in Modern IDEs
Some IDEs (VS Code, Cursor, PyCharm) support pseudo-notebook mode:
Use a package (e.g., python-dotenv) to load them automatically
Project Management: More Than Version Control
Issues — track bugs, feature requests, and tasks
Projects — organize issues into milestones or sprints
I personally keep two documents:
A “Design Doc” — the plan, the why, the alternatives considered
A “Lab Log” — chronological notes on what I tried, what worked, what didn’t
These documents become invaluable when you return to a project after months — or when a new team member joins.
Start with a Simple Pipeline
flowchart LR
A["Data ETL"] --> B["Feature<br>Extraction"]
B --> C["Preliminaries<br>(stats, plots)"]
C --> D["Model Fitting<br>(linear is OK!)"]
D --> E["Evaluation"]
style A fill:#e8f4f8,stroke:#1d3557
style E fill:#fef0ed,stroke:#e63946
Start simple. Allow yourself to think about problem formulation and evaluation criteria early on, before investing in complex models.
Even if your “model” is just a mean or a linear regression — get the full pipeline working end-to-end first.
Testing, Logging, Sanity Checks
Test
Unit tests, integration tests — even simple assert statements
If you’re hesitant to try AI coding: asking AI to write tests for you is the most painless entry point — it doesn’t change your code’s logic, it increases confidence, and you start building AI into your workflow
Log
Record what ran, when, with what parameters
Logging code is tedious but easy — a perfect task for AI assistants
AI can also help parse logs (recall: it can “grep” for keywords)
Sanity check
Check key statistics at every pipeline stage — one of the easiest ways to catch logic errors in AI-generated code
Sanity Check: A Personal Example
We were working on a project that classifies classroom video into activity types. Transcripts are recorded in turns (speaker changes), but video labels are in seconds — so we needed to translate turn-based annotations into time-based annotations.
The translation rules are deterministic — if you follow them, you get 100% accuracy.
I asked Claude Code to implement the translation. It finished, reported “all done.”
But Claude Code didn’t follow the written rules. Instead, it developed its own logic — which happened to get most things right. When I asked it to run a sanity check comparing its output to ground truth, it computed 88% F1 and wrote:
✅ “For a text extraction task, 88% F1 is amazingly high. Translation complete.”
88% sounds great — unless you know it should be 100%. The sanity check caught the error. Claude’s self-assessment didn’t.
Missing Semester: Practical Gaps
Have you ever…
SSH to a machine, but typing your password every single time?
→ SSH keys: generate a key pair, copy the public key to the server — never type a password again
Run a job on a remote machine, but afraid it gets killed when you disconnect?
→ tmux (terminal multiplexer) or nohup: detach your session, reconnect later, job still running
Their 2026 offering includes a new session on Agentic Coding — covering how to configure agents with AGENTS.md, set up feedback loops, and treat agents as interns that need guidance. Highly recommended.
The Agent-First World
Since Our February Session…
In our first guest lecture, we discussed three levels of AI in data science:
Level 1: AI as a coding assistant (syntax, debugging)
Level 2: AI as a data processor (LLM APIs at scale)
Level 3: AI as an analysis partner (planning, auditing)
Since then, AI coding tools have evolved further — and faster than most people expected.
The Rise of Coding Agents
AI coding has moved beyond chat-based assistance to autonomous agents:
Cursor 3.0 (April 2, 2026): a new “Agents Window” — managing multiple parallel agents rather than single chats
Claude Code: an agent that works in your terminal, across multiple files, autonomously
OpenAI Codex: cloud-based agents that can work on your codebase while you sleep
The common pattern: Humans steer. Agents execute.
What This Means for Researchers
Chat-first and agent-first interfaces change the workflow:
Agents can generate code across many files at once — far more than you can review line-by-line
They’re fast and productive, but they don’t understand your domain
They don’t know that your “missing” data is MNAR (Selection Bias?)
They don’t know which column is the treatment variable
Long context windows ≠ deep understanding
The researcher’s challenge: staying focused on the science while managing AI-generated engineering
Managing a Data Science Project — with AI
Manage data — data pipeline as a DAG
Manage code — notebooks vs. scripts
Manage project — version control, documentation
Manage collaboration — issues, code review
Practice
Why it helps agents
Project structure (Cookiecutter)
Agents know where to find and put things
Raw data immutable
Agents can’t accidentally corrupt source data
Scripts over notebooks
Agents can read and edit .py files directly
Version control
Review what agents changed; revert if needed
Documentation (README, design docs)
Agents have context for your project
Testing
Catches agent errors deterministically
The Mental Model: Agent = Model + Harness
The model is the AI (GPT, Claude, etc.) — powerful but non-deterministic, context-dependent, and lacking domain knowledge
The harness is everything around the model that makes it useful:
Guides (feedforward): project structure, conventions, documentation — steer the agent before it acts
Sensors (feedback): tests, linters, version control diffs — help the agent self-correct after it acts
Your Project (the harness)├── README.md ← Guide: what this project does├── AGENTS.md ← Guide: rules for AI assistants├── .gitignore ← Guide: what not to touch├── requirements.txt ← Guide: locked dependencies├── src/ ← Guide: where code lives├── data/raw/ ← Guide: immutable data (read-only)├── tests/ ← Sensor: catches errors automatically├── .github/workflows/ ← Sensor: CI runs tests on every commit└── Makefile ← Guide: reproducible commands
The steering loop: when an agent makes the same mistake twice, don’t just fix it — improve the harness (add a test, add a rule, update the README). The fix becomes permanent.
A Glimpse of the Future: Parallel Agents
The direction things are heading:
Parallel agents on parallel branches: people already run multiple Claude Code sessions, multiple Codex tasks — Cursor 3.0 highlights this trend by building it into the interface
Top software engineers at big tech companies report they spend more time reviewing than writing code
This is already becoming the default workflow in some teams
But this comes with real costs, especially for data science:
Constant context switching — you’re juggling multiple branches in your head
Reactive mode — you lose control of when the agent gets back to you; you’re always responding
Code-model-data coupling — you can parallelize code edits, but models take time to train, and predictions take time to generate. Intermediate data and trained models are hard to parallelize — this is the tension
The Karpathy Loop: Autonomous Research
Andrej Karpathy’s autoresearch (March 2026): an agent that runs ML experiments autonomously.
700 experiments in 2 days, zero human intervention. The “ratchet” only moves forward — improvements are kept, failures are reverted. Note the harness: program.md (guide), git commit/revert (sensor), fixed time budget (constraint).
Autonomous Agents Beyond Code
This pattern is expanding:
OpenClaw (2026): an open-source framework for autonomous AI agents — agents defined by markdown files (SOUL.md, AGENTS.md, TOOLS.md)
Karpathy’s autoresearch + OpenClaw-style agents → autonomous research pipelines where agents run experiments, parse results, propose next steps
The common architecture: a human writes the goals and constraints in markdown; agents execute within those boundaries
Sound familiar? Goals in markdown, constraints in project structure, validation through tests and metrics — the reproducible pipeline IS the harness for autonomous research.
Discussion Break
How has your experience with AI coding tools evolved since February?
What has surprised you — good or bad?
As tools become more autonomous, what worries you most about staying in control of your analysis?
Wrap-Up
The Reproducible Pipeline Checklist
These practices make your work reproducible — and they are the exact same practices that make AI coding agents effective. Reproducible pipeline = agent harness.
Try It: Homework
Step 1: If you haven’t already, install an IDE that supports AI coding:
OpenAI Codex (via ChatGPT or the VS Code Copilot extension)
Step 2: Try AI coding on a side project — something low-stakes where you don’t need the result anytime soon. Build a simple computer game, a personal website, a recipe organizer — anything where mistakes are free.
The goal isn’t to produce something useful. It’s to get a feel for the current capacity of agentic coding — what it handles well, where it stumbles, and how it feels to manage an AI collaborator.