From Data to Learning

Data-Driven Modeling in Science and Engineering

Announcements and Logistics

  • Course site: ml4science.com. Maths and Python reference: intro2ml.com
  • Assignment 0 is posted: Problem Set 0
  • The purpose of this class is to learn how to learn. In fields that move this fast, papers are the medium, not textbooks.
  • scholar-inbox.com, plus YouTube, blogs, and whatever else keeps you current
  • The simple formula: read a paper, clone the repository, reproduce the result, come back with a question
  • Main deliverable: a presentation and a paper

Finding constants of Nature That Generalize Across Space and Time

Galileo dropping a ball from the leaning tower

Galileo

Kepler, Epitome Astronomiae Copernicanae

Kepler

Descartes, La Dioptrique

Descartes

Galileo's cartoon says the quiet part out loud: "It shouldn't happen this way. I'll have to alter the data."

The Three Pillars of Artificial Intelligence

The world is messy. The question is simple: what is the shortest way home?

Modeling
Throw the city away. Keep junctions and the cost of each road.
Learning
You are not given the costs. You estimate them from journeys people already made.
Inference
With a model in hand, answer the question you actually asked.

The Data Science Hierarchy of Needs

The data science hierarchy of needs

As illustrated by Monica Rogati. Most of the pyramid is not machine learning: it is collecting, moving and cleaning the data first.

What are* data?

Anything the world leaves behind that we can record.

numbers sound images video language games networks

Today: all of these become numbers.

*one datum, many data

Stocks

hover a row

  • A table and a curve: the same object
  • Each row is a pair \( (t_i, x_i) \)

Audio

hover the waveform to zoom in · 44,100 numbers per second
  • Speech recognition is a function \( F: \text{array} \rightarrow \text{text} \)

From a Wave to a Picture

The short-time Fourier transform: the first thing anyone does to a sound before modelling it

time across · frequency up · brightness is energy
  • The waveform is one number per instant. It hides which frequencies are present.
  • Cut the signal into short windows, take the Fourier transform of each, stack them side by side. Now pitch is visible.
  • Speech recognisers and birdsong classifiers almost never see the wave. They see this picture.

Images

move your mouse over the image

  • A color image is \( h \times w \times 3 \): height, width, and three channels (red, green, blue)
  • Your phone: \( 3000 \times 4000 \times 3 = 36 \) million numbers per photo

Colour Is Three Matrices

The grey image was one number per pixel. Colour is three, stacked

a 4 by 4 patch, and the numbers behind it
  • A colour image of height \(h\) and width \(w\) is an array of shape \( h \times w \times 3 \).
  • Nothing about it is a picture to the machine. It is three grids of numbers between 0 and 255.

Image Recognition

  • 2010: deep learning passes traditional methods at speech recognition
  • 2011: IBM Watson beats the best human players at Jeopardy
  • 2012: Google Brain finds cats in YouTube, unsupervised
  • 2014: face recognition reaches 97%
  • 2019: deep models match radiologists on lung scans
  • 2021: AlphaFold predicts protein structure from sequence
  • 2022: text becomes images, and images become text
  • 2024: one model reads an image, a page and a recording together
  • 2026: two lines of prompt produce fifteen seconds of film

The same training recipe each time, on new data.

chest radiographs

2019: lung cancer detection from chest scans
Ardila et al., Nature Medicine 2019

Generative Adversarial Networks (2014)

Progressive growing of GANs, generated faces

Karras et al., Progressive Growing of GANs for Improved Quality, Stability, and Variation. Video

Coupled Ocean Atmosphere Simulation

Coupled ocean atmosphere simulation

youtube.com/watch?v=4f0iVY2nd2M

Video

Eadweard Muybridge, 1878: the first time motion was recorded as an array of stills

click any frame to move the square · the grid is the real pixels under it t = 1 of 12
  • One frame is \( h \times w \times 3 \); a clip is \( T \times h \times w \times 3 \)
  • One minute of 1080p at 30 fps: about 11 billion numbers
  • Muybridge settled a bet: are all four hooves ever off the ground at once? You cannot see it, so he turned it into data.

Frames from The Horse in Motion, Wikimedia Commons, public domain.

Fluid Dynamics

Fluid dynamics simulation

Machine Learning in Materials Research

Machine learning in materials research

Text

One-hot word representation

hover a word: its column lights up

  • One-hot is honest but lonely: every word equally far from every other

Text

Word embedding representation

man
woman
king
queen
direction means something \( \vec{v}_{\text{king}} - \vec{v}_{\text{man}} + \vec{v}_{\text{woman}} \approx \vec{v}_{\text{queen}} \)

Text Generation

Text generation example

Language Models That Do Science

Language models doing science

arxiv.org/abs/2503.08979

Games

IBM checkers program

IBM creates a checker-playing program · 1959

Deep Blue beats Kasparov

IBM Deep Blue beats Kasparov · 1997

AlphaGo

AlphaGo beats the world's best Go player · 2016

Solving Puzzles

puzzle 1puzzle 2puzzle 3puzzle 4puzzle 5

A Rubik's cube has 10120 possibilities. You cannot search that. You have to learn something about its structure instead.

Graph Representation

click two nodes: the matrix follows
  • Maps, molecules, social networks: all matrices, \( A_{ij} = 1 \) when \(i\) connects to \(j\)

Robotics and Games: Reinforcement Learning

Reinforcement learning in robotics and games

Robotics and Manufacturing

Robotics in manufacturing

Robotics

Boston Dynamics robot

Boston Dynamics · youtube.com/watch?v=tF4DML7FIWk

Classification, Regression, Structured Prediction

\( x \) \( \xrightarrow{\;f\;} \) \( y \)
credit card transaction \( \rightarrow \) fraud / not fraud classification
measurements of a collision event \( \rightarrow \) Higgs decay / background classification
satellite image of a region \( \rightarrow \) poverty index regression
information about a house \( \rightarrow \) price regression
English sentence \( \rightarrow \) Japanese sentence structured
image \( \rightarrow \) sentence describing it structured

Same skeleton every time. Only the shape of \(y\) changes.

Now you: think of one input-output pair from your own life. What is \( x \), what is \( y \), and which of the three is it?

Data Analysis

Before a model, the summaries: what one variable does, and what two of them do together.

Correlation Coefficient (2 Variables)

\( r_{XY} = \dfrac{\sum_i (x_i - \bar{x})(y_i - \bar{y})} {\sqrt{\sum_i (x_i - \bar{x})^2 \sum_i (y_i - \bar{y})^2}} \)
  • Linear co-movement, from \( -1 \) to \( +1 \)
  • \( r = 0 \) means not linear, not unrelated

Correlation Matrix (Multiple Variables)

\( r_{ij} = \dfrac{\mathrm{Cov}(X_i, X_j)}{\sigma_{X_i} \sigma_{X_j}} \), assembled into \( R \): every pair at once, the diagonal all ones.

A correlation matrix heatmap

statology.org

Histogram and Probability Density Function

key distinction The histogram is data. The curve is a model.

Box and Whisker Plot

Box and whisker plot anatomy
Box plots compared

Five numbers instead of a histogram: minimum, lower quartile, median, upper quartile, maximum. Boston University SPH

Where to Look for Data?

  • Curated: Kaggle, UCI, Hugging Face, data.gov
  • Collected: sensors, experiments, your phone
  • Scraped: the web, politely
  • Asked: a language model will name datasets you would not have found, and invent ones that do not exist. Check every link it gives you.

import pandas as pd

url = "https://raw.githubusercontent.com/mwaskom/seaborn-data/master/penguins.csv"
df = pd.read_csv(url)

print(df.shape)        # (344, 7): 344 penguins, 7 measurements
print(df.describe())   # your first look at any dataset
    

How Do You Come Up With Project Ideas?

  • Start from something you already care about, then go looking for whether anyone has measured it
  • Search properly: Google, Google Scholar, and ask a model to argue with you about it
  • Read a paper, clone the repository, reproduce the result. The gap between what the paper claims and what the code does is where the project ideas live.
  • A good idea names its data before it names its method.

Next session

Data is the interface
between the world and the model.

Thursday: the math and Python toolkit.
Before then: PS0, and run the penguins line yourself.