Week 01 · Page 1 of 4 · Lesson

Every method in this course is a variation on one idea: let a computer find a rule that fits examples, instead of writing the rule down yourself.

Lesson Definitions Worked Examples

1. The traditional way physics builds a model

Consider how you would normally predict the formation energy of a compound. You would set up its crystal structure, choose a density functional, run a self-consistent field calculation, and extract the total energy. The relationship between structure and energy is never written down explicitly as a formula you typed in — it emerges from solving the Schrödinger-like equations of density functional theory. But the procedure itself, the algorithm you follow, was designed by hand, by physicists, decades ago, based on physical reasoning about how electrons behave.

Machine learning offers a fundamentally different procedure. Instead of designing the rule by hand, you show the computer many examples of inputs and known outputs, and ask it to find a rule on its own that fits those examples well — one that should also work on new inputs it has never seen.

Machine Learning

Machine learning is a method for building a predictive model by fitting it to examples of data, rather than by deriving it from theory. The model's internal parameters are adjusted automatically so that its predictions match a set of known examples as closely as possible; the resulting model can then be used to predict outputs for new, previously unseen inputs.

This definition is deliberately narrow. It does not say machine learning "discovers physics," "thinks," or "understands" anything. It is a curve-fitting procedure — an extremely flexible and powerful one, but a curve-fitting procedure nonetheless. Keeping this definition in mind will save you from a great deal of confusion later in the course, especially once the curves being fit become deep neural networks with millions of parameters.

2. The vocabulary you need before anything else

Four words will appear in almost every sentence of this course from now on. Learn them precisely; sloppy use of these terms is the most common source of confusion for students new to the field.

Feature

A feature is one measured or computed input quantity describing an example. If you are trying to predict a compound's formation energy, features might include the average electronegativity of its constituent atoms, the number of valence electrons, or the unit cell volume. A complete set of features for one example is sometimes called a feature vector.

Label (or target)

A label is the known output value you want the model to learn to predict, attached to a given example in your training data. For a formation-energy model, the label is the actual computed (or measured) formation energy of each compound in your dataset. Labels are only available for supervised learning, introduced below.

Model

A model is the mathematical object — a formula, a decision procedure, or a more complex structure such as a neural network — that takes a feature vector as input and produces a prediction as output. A model has internal numbers called parameters that determine exactly what it computes; these are what get adjusted during training.

Training

Training is the process of automatically adjusting a model's parameters so that its predictions on the known examples (the training data) match their true labels as closely as possible. The result of training is a model ready to be used on new data — a step called prediction or inference.

A sentence to memorize

"We trained a model on features to predict a label." If you can correctly identify the feature(s), the label, and the model in any machine learning description you encounter — in a paper, a talk, or later in this course — you have understood the sentence. If you cannot, stop and ask which of the three is missing or unclear.

3. The first fork in the road: supervised vs. unsupervised

Not every machine learning problem has labels. This distinction is the single most important branching point in the entire field, and it determines which methods are even applicable to your problem.

Supervised learning

Supervised learning is the setting in which every training example has a known label, and the goal is to learn a model that predicts the label from the features. "Supervised" refers to the fact that the correct answers supervise — that is, guide and correct — the training process.

Unsupervised learning

Unsupervised learning is the setting in which training examples have features but no labels at all, and the goal is instead to discover structure in the data itself — for instance, finding that the examples naturally fall into groups, or finding a simpler way to represent them. There is no "correct answer" to check against; success is judged by whether the discovered structure is useful or meaningful.

QuestionSupervisedUnsupervised
Do you have labels?Yes, for every training exampleNo
What is the goal?Predict the label for new examplesDiscover structure (groups, patterns)
Materials examplePredict band gap from compositionFind natural families among 500 unlabeled compounds

4. Worked example A — a supervised problem, solved by hand

Worked Example · Supervised Regression

Suppose you have computed the formation energy of four hypothetical compounds, and you want to predict the formation energy of a fifth, related compound without running the full calculation. Your dataset:

CompoundFeature: Average electronegativity difference (Δχ)Label: Formation energy (eV/atom)
A0.5−0.20
B1.0−0.55
C1.5−0.85
D2.0−1.15
Step 1 — identify the pieces

The feature is Δχ (one number per compound). The label is the formation energy. This is supervised learning because every compound already has a known label.

Step 2 — propose a model

The data looks roughly linear. Propose the simplest possible model: E = a · Δχ + b, where a and b are the model's parameters to be determined by training.

Step 3 — train (fit) the model

Using compounds A and D to anchor a quick estimate: the energy changes by −0.95 eV (from −0.20 to −1.15) as Δχ changes by 1.5 (from 0.5 to 2.0), giving a slope a ≈ −0.633. Solving for the intercept using compound A: −0.20 = (−0.633)(0.5) + b, so b ≈ 0.12. A real training procedure (covered in Week 3) would use all four points at once via least-squares fitting, but this hand estimate already captures the idea: training means finding numbers for a and b that make the line pass close to all the known points.

Step 4 — predict

For a fifth compound E with Δχ = 2.5, the trained model predicts E ≈ (−0.633)(2.5) + 0.12 ≈ −1.46 eV/atom — without ever running a calculation on compound E.

The point of this example: nothing here required a computer. The "machine learning" was finding a line through points. Everything this course adds from Week 3 onward is about doing this same thing — finding parameters that fit examples — with far more features, far more data, and far more flexible models than a straight line.

5. Worked example B — an unsupervised problem, solved by hand

Worked Example · Unsupervised Grouping

Now suppose you have six compounds and only their features — no label, because the property you eventually care about (say, magnetic ordering) has not been computed for any of them yet. You simply want to know: do these six compounds form natural groups?

CompoundFeature 1: d-electron countFeature 2: Average ionic radius (Å)
P20.65
Q20.68
R30.63
S70.90
T80.92
U70.88
Step 1 — identify the pieces

There are two features per compound (d-electron count, ionic radius) and no label of any kind. This is unsupervised learning: there is nothing to predict, only structure to discover.

Step 2 — look for structure

Plotting these two features against each other (do this on paper now, briefly), compounds P, Q, R cluster near (d-count ≈ 2–3, radius ≈ 0.63–0.68), while S, T, U cluster near (d-count ≈ 7–8, radius ≈ 0.88–0.92). No label told you this — the grouping is visible directly in the features themselves.

Step 3 — interpret, carefully

The grouping is a hypothesis, not a proven fact. It might correspond to a real physical distinction (e.g. early vs. late transition metals), or it might be an artifact of which two features you happened to plot. Unsupervised learning proposes structure; deciding whether that structure is physically meaningful is the scientist's job, not the algorithm's.

This exact idea — grouping points using only their features — is formalized in Week 5 under the name clustering, with algorithms that do automatically, in many dimensions, what you just did by eye in two.

6. Why this distinction matters for your own research

Before continuing to the Directed Work page, hold the following question in mind, because it is the basis for this week's in-class exercise: for a materials problem you know well, do you currently have labels? If you have a database of compounds with computed formation energies, you are in a supervised setting. If you have a large set of candidate structures with no computed property at all, you are in an unsupervised — or, more realistically, a "not yet labeled" — setting, and the more urgent question is often not which algorithm to use, but which labels are worth the computational cost of generating.

Common confusion, addressed directly

Students sometimes ask whether unsupervised learning is simply supervised learning without enough data yet. It is not. The two settings answer different questions even when given infinite data: supervised learning answers "what is the label of this new example," while unsupervised learning answers "what structure exists in this set of examples," a question that remains meaningful even when no label is ever defined.

Next on this week's pages

Proceed to the Directed Work page, where you will work through two further problems — one supervised, one unsupervised — on a new, slightly larger dataset, with full solutions provided so you can check your reasoning at each step.

← Week 1 Overview Lesson · Page 1 of 4 Directed Work →