CULS5413 · Social Data Workshop · Part 1

Hands-on Memo

Doing Data Science with AI — your take-home guide

Thu 24 Sept 2026 · 19:00–21:00 · Digital Scholarship Lab, CUHK Library  ·  Charlie Chen 陳申

This memo replaces the slides as your hands-on guide. Everything we demoed tonight — datasets, setup steps, keys, prompt templates — lives here, so you can replay every demo at home.

One vocabulary note before we start. An agent is an AI that doesn't just answer — it acts: reads your files, writes and runs code, fixes its own mistakes, in a loop, until the job is done. A notebook is a document where code and results live together (tonight: Jupyter notebooks). A kernel is the Python engine that actually runs a notebook's code.


1Datasets

All three datasets are free on Kaggle. Downloading requires a free Kaggle account: sign in, open the page, go to the Data tab, click Download (or download an individual CSV).

# Dataset Kaggle link Size Key columns A good first question
1 Titanic — Machine Learning from Disaster https://www.kaggle.com/datasets/yasserh/titanic-dataset train.csv = 891 rows (one per passenger) age, sex, ticket class, fare, family aboard, survived Who survived, and why?
2 Trending YouTube Video Statistics (US) https://www.kaggle.com/datasets/datasnaek/youtube-new USvideos.csv ≈ 40,000 rows (one per trending video) views, likes, comments, channel, category, tags What kind of video dominates the trending list?
3 Speed Dating Experiment https://www.kaggle.com/datasets/annavictoria/speed-dating-experiment several thousand rows (one per date pairing — exact size on the Data tab) attributes participants rated, decisions, matches What actually predicts a "yes" on a first date?

Notes:


2Local environment setup (step by step)

Goal: everything running on your own computer — no quotas, no VPN, files as big as your hard drive. The stack:

Anaconda (Python + JupyterLab) → jupyter-ai (chat panel inside JupyterLab) → jupyter-server-mcp (the plug that lets an agent drive your notebook).

2.1 Install Anaconda and OpenCode

  1. Go to https://www.anaconda.com/download (official site only; you can skip registration).
  2. Download the installer — choose Anaconda Distribution (the full version), not Miniconda.
  3. Run the installer, click Next / Install.
  4. Windows users: on the "Advanced Installation Options" screen, if you do not have other Python installations, check all the checkboxes (this puts Anaconda's Python on your PATH).
  5. Test: open Anaconda Navigator and click Launch on JupyterLab. A browser tab with the JupyterLab interface should open.
  6. OpenCode can be installed by following: https://opencode.ai/docs/

2.2 Open a terminal with Anaconda's Python

You can install jupyter-ai and jupyter-server-mcp in Anaconda Navigator under the "Environments" tab; or, following everything below, which is typed in that terminal.

2.3 Install jupyter-ai

You can install it and jupyter-server-mcp in Anaconda Navigator UI

What it is: a chat panel inside JupyterLab where you talk to an AI about your notebook — and where you can define personas (the AI's configured identity: a name, a role, a standard of rigour — the same model, wearing a different hat).

pip install "jupyter-ai[all]"

([all] installs every model provider, so you can plug in any provider's key later. Slower to install, but saves troubleshooting.)

Then relaunch JupyterLab (jupyter lab from the terminal, or via Anaconda Navigator). You should see the AI chat panel on the left.

Try a persona (in the chat panel's persona settings): "You are a rigorous statistician and a patient tutor. Explain every step in plain English before showing code."

2.4 Install jupyter-server-mcp (the universal plug)

What it is: MCP (Model Context Protocol) is an open standard — a universal plug between AI agents and tools. jupyter-server-mcp is a small server that runs alongside your Jupyter and exposes your notebooks over MCP, so an outside agent can read cells, edit them, run them, and read errors back.

pip install jupyter-server-mcp

It is a Jupyter server extension — no separate command to run. Start JupyterLab normally and the MCP server starts with it, listening on port 3001 by default. Check the startup log for a line announcing the MCP server URL; it shall be something like http://localhost:3001/mcp.

If the server does not start, check that the extension is enabled:

jupyter server extension list

and enable it if missing:

jupyter server extension enable --py jupyter_server_mcp

3Connect your agent to your notebook (CodeBuddy as the example)

What CodeBuddy is: a desktop AI agent that looks and feels like VS Code (and runs VS Code-style extensions). Its non-coder-friendly edition is called WorkBuddy. It can drive your Jupyter notebooks through the same MCP plug from §2.4.

3.1 Install CodeBuddy

  1. Go to https://www.codebuddy.ai/home.
  2. Download the installer for macOS or Windows, run it, sign in.

3.2 Give it a model — Add Custom Model

CodeBuddy can use any compatible provider, not just its own. In settings, choose Add Custom Model, then paste an endpoint URL and an API key from §4. Recommended for tonight's tools:

For model choice, glm-5.3-flash is highly recommended

3.3 Install the Jupyter Bridge MCP extension

In CodeBuddy's extensions panel (the VS Code-style marketplace), search for the Jupyter Agentic Bridge extension and install it.

3.4 Point the MCP client at your notebook server

In CodeBuddy, View -> Command Palette -> Jupyter Agentic Bridge: Create MCP Config -> Copy to Clipboard, in the settings gear -> MCP -> Configure MCP Settings, paste the config.

3.5 Verify

With JupyterLab running (and the Titanic notebook open), ask your agent:

"List the notebooks you can see, then open the Titanic notebook and tell me how many rows and columns it has."

If it answers, everything is connected: the agent can now read, edit, run, and fix your notebook cells from outside.

The same trick works with any MCP-capable agent — OpenCode, Claude Code, Codex, etc. The plug is the standard; only the settings panel differs. For OpenCode specifically: install it (macOS: curl -fsSL https://opencode.ai/install | bash; Windows: see the guide below), then configure the same Jupyter MCP server in its settings.

https://opencode.ai/docs/


4API keys & endpoints

Provider Endpoint URL API key Expires Notes
Poe https://api.poe.com/v1 sk-poe-Z-jjZUpu91MfuDke9mCBB41-YHzLnBOQ3jjxL0HqeS0 in 7 days (≈ 1 Oct 2026) One key, access to many models (Claude, GPT, Gemini, open models)
Ollama Cloud https://ollama.com/v1 — bring your own key — Open-weight models (Qwen, GLM, DeepSeek, Llama families); sign up at https://ollama.com
OpenCode Go https://opencode.ai/zen/go/v1 - bring your own key in 30 days (≈ 24 Oct 2026) Cheap, fast "Go" models; need to use together with OpenCode

Suggested model: glm-5.3-flash All three speak the same API format, so in "Add Custom Model" you only ever paste two things: the endpoint and the key.

⚠️ Key hygiene

  • These keys are short-lived and shared — fine for coursework, not for anything sensitive. They expire on the dates above.
  • Don't post them publicly (GitHub, Discord, course forums).
  • When they expire, get your own: first-party channels are preferred. (Cheap token resellers — 中转站 — exist, but carry security and reliability risks; if you use one, do your own research. Not recommended.)
  • Model names worth trying on these endpoints: glm-5.3, glm-5.3-flash, deepseek-v4.1-flash — powerful open models at very low cost.

How smart is each model? Check a public leaderboard before choosing: https://artificialanalysis.ai/leaderboards/models


5Prompt templates by workflow

The common data science workflow:

  1. Data Loading & Overview & Clean
  2. Exploratory Data Analysis (EDA)
  3. Data Visualization
  4. Feature Engineering
  5. Interpretation or Model Training & Evaluation
  6. (Optional) Prediction & Submission

Tips: you can Enhance Prompt feature in CodeBuddy

Good prompts can have the same four-part skeleton. Learn the skeleton, not the words:

Part What it does Example
Role sets the AI's job and standard "You are a careful data analyst."
Context tells it what the data is "891 Titanic passengers; columns: age, sex, class, fare, survived"
Goal the one thing you want "Tell me which factors decided survival."
Format the shape of the answer "A short summary, then two charts, then three bullet findings."

Golden rule: paste the column list into Context. The AI can't guess your data's structure, and this one habit prevents most bad answers.

5.1 Profiling & cleaning — what is this data?

Template:

Role: You are a careful data analyst. Context: I have uploaded [filename] — a dataset of [what one row represents], with columns: [paste column list]. Goal: Give me a profile: how many rows and columns, what each column means, what data is missing or messy. Then propose a cleaning plan — but do not apply it yet. Format: A short summary table, then a bullet list of problems, then your proposed fixes.

Worked example (Titanic — tonight's exact demo):

"Look at this dataset and give me a quick profile: how many rows and columns, what does each column mean, what data is missing?"

Cleaning follow-up (YouTube dataset):

"The date column is in a weird format, category_id is a bare number, and the tags are glued together with pipes (|). Clean all three, and show me the code so I can read what you did."

5.2 Exploratory analysis & visualization — what does the data look like?

Template:

Role: You are a careful data analyst who explains in plain English. Context: [dataset description + column list] Goal: Show how [main variable] relates to [grouping variable]. Format: One chart with a clear title and axis labels, plus two sentences interpreting what the chart shows.

Worked example (Titanic):

"Make a chart of survival rate by gender and by ticket class, side by side. Then explain, in two sentences, what the picture says about who got on the lifeboats."

5.3 Interpretation & statistical thinking — what does it mean?

Template:

Role: You are a rigorous statistician. Flag uncertainty honestly. Context: [dataset description] — here is the summary you just produced: [paste it]. Goal: Which differences are real signal, and which could be noise or a confound? What would you check next? Format: Three bullet points of findings ranked by confidence, then one sentence on the biggest caveat.

Worked example (YouTube):

"Entertainment and music dominate the trending list, and the same channels appear day after day. Is that evidence the platform favours them, or just what popularity looks like? What else would we need to check before claiming that?"

5.4 Prediction — can a model guess the outcome?

Template:

Role: You are a careful data scientist. Context: [dataset description]. The target column (the thing to predict) is [column]. Goal: Build a simple classification model to predict it, and tell me honestly how well it performs. Format: The code, one paragraph explaining the approach in plain English, and the accuracy number with what it means for a beginner.

Worked example (Titanic):

"Using the Titanic passengers, build a simple model that predicts survived from sex, pclass, age, and fare. How accurate is it — and is that good or bad, compared to always guessing 'died'?"

5.5 Text & UGC analysis — what are people saying?

(Most relevant for this course — user-generated content.)

Template:

Role: You are a careful qualitative researcher with data skills. Context: I have a column of [what the text is: posts / comments / reviews / tags] from [source], in [language(s)]. Goal: Analyse the sentiment and the main recurring topics. Note slang, sarcasm, and mixed-language text as limitations. Format: One chart of sentiment distribution, one list of top five topics with one example quote each, then one paragraph on what the analysis cannot tell us.

Worked example (YouTube tags — tonight's demo theme):

"The tags column contains creators' own keywords. Treat the tags as creators speaking to the algorithm: what are the top 20 tags, and what do they suggest creators think the platform rewards?"

5.6 The error-fixing playbook — when it breaks

The single most useful skill tonight. When you hit a red wall of error text:

Step 1. Paste the complete error into the chat. Step 2. Ask: "Explain this error in one sentence." (Understanding before fixing — never skip this.) Step 3. Ask: "Now fix the cell." Step 4. Re-run. Verify the fix did what you expected. Step 5. Stay skeptical: an AI that "fixed" something deserves your verification every time.

Errors are not walls — they're questions you haven't asked yet.


6Skills — teach once, reuse forever

A skill is a small written procedure your AI can load and follow — "how to clean a CSV", "how to make publication-quality charts". Write it once (and the agent applies it every time), or don't write it at all and use a ready-made one.

Where to find ready-made data-science skills:

Two worth starting with (we mentioned them tonight): python-dataviz (for charts) and data-storytelling (for writing the interpretation paragraph your final project needs).

Why skills matter more than tools: a skill travels with you — the same "screen this contract for red flags" or "summarise a case file" procedure works in CodeBuddy, OpenCode, Claude, or any agent. It is the most transferable thing you'll take from this workshop.


7Quick troubleshooting

Problem Likely cause Fix
Colab AI features not visible in Hong Kong Google doesn't offer them in our region Connect a VPN, reload Colab — this is the region quirk we demoed live
pip / python not found (Windows) Anaconda not on PATH Use Anaconda Powershell Prompt, or reinstall Anaconda with all Advanced boxes checked (§2.1)
AI chat panel missing in JupyterLab jupyter-ai not installed, or JupyterLab not restarted pip install "jupyter-ai[all]", then quit and relaunch JupyterLab
Agent can't see my notebook MCP server not running, or wrong URL Confirm the port-3001 line in JupyterLab's startup log; re-check the URL in the agent's MCP settings (§3.4)
"Unauthorized" / model refuses to answer API key expired or typo'd Keys in §4 expire quickly — get your own from the provider's official site
Everything installed but results look wrong The prompt, not the tool Check §5: did you paste the column list and ask for a specific format?
Windows: scripts blocked from running Execution policy In an admin PowerShell: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Still stuck? Email me after the workshop — charlie.chenshen@gmail.com — or bring your laptop to the hands-on session.


8Cheat sheet — every tool from tonight

Tool What it is What it's best at Link
Gemini App AI chat in a browser tab The easiest door: upload a small CSV, ask questions, zero setup https://gemini.google.com
Google Colab Jupyter notebooks in your browser (Google's computers) Real notebooks, no install; the one tool that can carry your whole project (AI features need a VPN in HK) https://colab.research.google.com
Anaconda "Python with all the toolboxes pre-installed" The one installer that gets you Python + Jupyter + everything https://www.anaconda.com/download
JupyterLab The notebook interface data scientists use The desk: your code and results live together comes with Anaconda
jupyter-ai AI chat panel inside JupyterLab Personas — define your assistant's role, tone, standards pip install "jupyter-ai[all]"
jupyter-server-mcp The universal plug (MCP) for your notebooks Lets outside agents read/edit/run your notebook cells pip install jupyter-server-mcp
CodeBuddy / WorkBuddy Desktop agent that feels like VS Code The whole loop in one self-contained IDE — especially Windows-friendly https://www.codebuddy.ai/home
OpenCode Open-source agent in your terminal Cheap, provider-agnostic; the same tricks without an IDE https://opencode.ai/docs/
Ollama Run small models on your own machine Zero API cost, fully private; needs a decent machine https://ollama.com
Artificial Analysis Public model leaderboard How to choose a model when a tool lets you choose https://artificialanalysis.ai/leaderboards/models
skills.sh / skills-hub.cc Skills directories Ready-made procedures your AI can load and follow https://skills.sh · https://skills-hub.cc