⚛️ Introduction to Quantum Machine Learning

Can Quantum Machine Learning Beat Classical Machine Learning? An Honest Answer for Materials Researchers

📖 Reading Time: 20-25 minutes 📊 Difficulty: Beginner 💻 Code Examples: 0 📝 Exercises: 0

🌐 EN | 🇯🇵 JP | Last sync: 2026-08-13

AI Terakoya TopMaterials Informatics DojoIntroduction to Quantum Machine Learning

← Back to Materials Informatics Dojo

🎯 Series Overview

You already fit models to materials data. Somebody has already asked you whether quantum computing will change that. This series is the answer, worked out rather than asserted.

Quantum machine learning is the most oversold subject in quantum technology, and the overselling is not usually dishonest — it comes from a chain of individually correct statements that does not compose into the conclusion people draw from it. A register of $n$ qubits carries $2^n$ amplitudes; a quantum circuit induces an inner product between data points; that inner product can be hard to compute classically. All true. None of it says a quantum model will generalize better from forty rows of composition descriptors, which is the question a materials researcher actually has.

So this course does the arithmetic. Every experiment runs on one synthetic materials dataset with a fixed seed, one fixed train/test split, and one evaluation protocol strict enough that the later chapters cannot cheat: matched parameter counts, hyperparameters selected on training data only, a trivial baseline and a noise floor quoted alongside every result, a paired bootstrap interval on every difference the course claims — every chapter prints its own — and an explicit shot cost for anything a real device would have had to measure. Under that protocol, some quantum models here win and some lose, and Chapter 1 already contains the most instructive case — a quantum feature map that beats the classical baseline significantly, and is then reproduced to fourteen decimal places by evaluating sines and cosines of the descriptors, and pairwise products of them, on a laptop.

That result is the shape of the whole subject. The interesting questions turn out not to be "is quantum faster" but "what does the encoding actually assume about the physics", "why does an expressive kernel destroy its own ability to generalize", and "where in a materials workflow could a quantum processor plausibly attach at all". The honest answer to the last one is upstream of the machine learning, and Chapter 5 defends it.

This is the first quantum course placed in the Materials Informatics Dojo, and the placement is the point: it is written for people who will judge quantum claims against a classical baseline they already trust.

Learning Path

flowchart LR P1["Prerequisite
Quantum computing"] P2["Prerequisite
Classical ML"] A["Chapter 1
The QML
landscape"] B["Chapter 2
Data
encoding"] C["Chapter 3
Quantum kernel
methods"] D["Chapter 4
Variational
quantum models"] E["Chapter 5
An honest
assessment"] P1 --> A P2 --> A A --> B --> C --> D --> E style P1 fill:#e2e8f0,stroke:#94a3b8,stroke-width:1px,color:#334155 style P2 fill:#e2e8f0,stroke:#94a3b8,stroke-width:1px,color:#334155 style A fill:#667eea,stroke:#764ba2,stroke-width:2px,color:#fff style B fill:#7b2cbf,stroke:#764ba2,stroke-width:2px,color:#fff style C fill:#7b2cbf,stroke:#764ba2,stroke-width:2px,color:#fff style D fill:#7b2cbf,stroke:#764ba2,stroke-width:2px,color:#fff style E fill:#9d4edd,stroke:#764ba2,stroke-width:2px,color:#fff

The chapters are strictly sequential. Chapter 1 fixes the simulator, the dataset, the split, the classical baseline and the evaluation protocol, and every later chapter continues from that session; Chapter 2's encodings are what Chapter 3's kernels are built from; Chapter 4's variational models reuse Chapter 2's feature maps; Chapter 5 collects the evidence from all four. Reading out of order is possible but the code will not run.

📋 Learning Objectives

On finishing this series you will be able to:

📖 Prerequisites

Required. Introduction to Quantum Computing at the level of its Chapters 1 to 3: qubits and state vectors, the standard gate set, the mini state-vector simulator, variational circuits and the barren-plateau problem. The simulator of that course's Chapter 2 is re-listed verbatim in Chapter 1 here, and its API and big-endian qubit ordering are used unchanged throughout.

Required. Classical supervised learning at the level of regression, regularization, cross-validation and overfitting. Materials Informatics Introduction is the natural entry point from the materials side, and Model Evaluation Introduction covers the evaluation machinery this course leans on heavily. Familiarity with composition descriptors — see Introduction to Composition-Based Features — makes the synthetic dataset feel less abstract.

Required. Python 3.8 or later with NumPy, SciPy and Matplotlib. Nothing else. There is no quantum SDK, no vendor account, and no hardware access anywhere in these five chapters.

Recommended. Introduction to Quantum Hardware, for what the shot rates and error rates quoted in the cost estimates actually come from. Chapter 5 refers to it when it discusses what the QQ quadrant would physically require.

Useful but not required. Bayesian Optimization and Active Learning for the acquisition stage of the pipeline Chapter 1 maps out, and Machine Learning Potential (MLP) Introduction as the working example of the quadrant where quantum technology has already changed materials science.


📚 Chapters

Chapter 1: The QML Landscape

What is being claimed, and what would have to be true for the claim to hold. The four-quadrant taxonomy — classical or quantum data crossed with classical or quantum processing — and why materials informatics already has a quantum success story in the quadrant nobody calls QML. The case for QML (exponential state space, implicit feature maps, universality from data re-uploading) set against the four standing objections (the input problem, the output problem, dequantization, concentration) and the fifth that matters most: classical hardness of simulation is not a good inductive bias. A stage-by-stage map of where a quantum processor could attach to a descriptor-to-property pipeline. Then the seven-rule evaluation protocol that governs every later chapter, and the shared toolkit: the mini-simulator re-listed, the synthetic materials dataset, the closed-form ridge baseline that fixes the number to beat, and first measurements of both dequantization and concentration.

Key topics : four-quadrant taxonomy · input and output problems · dequantization · kernel concentration · inductive bias · equal-budget protocol · paired bootstrap · shot accounting · closed-form ridge baseline

💻 6 Code Examples ⏱️ 40-45 minutes 📊 Intermediate

Read Chapter 1 →

Chapter 2: Data Encoding — the Real Bottleneck of QML

How classical numbers get into a quantum state, and what each route costs. Basis, angle and amplitude encoding compared on qubit count, circuit depth and state-preparation difficulty, with the uncomfortable conclusion that the encoding which reaches the exponential space is the one you cannot afford to prepare. Encoding recast as a feature map $x \mapsto |\phi(x)\rangle$ with an induced inner product, which is what makes the kernel view of Chapter 3 possible. Data re-uploading, and why a single qubit with enough re-uploads is a universal approximator. Then the part that decides everything downstream: the encoding fixes the model's frequency spectrum, and therefore which functions it can represent at all. Closes with three encodings implemented, their induced kernel matrices visualized, and the Fourier spectrum of an angle-encoded model extracted numerically.

Key topics : basis / angle / amplitude encoding · state-preparation cost · feature maps and induced inner products · data re-uploading · universal approximation · bandwidth and frequency spectrum · Fourier analysis of a quantum model

💻 6 Code Examples ⏱️ 45-50 minutes 📊 Intermediate

Read Chapter 2 →

Chapter 3: Quantum Kernel Methods

The most theoretically satisfying corner of QML, and the one where the bad news is clearest. The kernel trick revisited, then the quantum kernel $k(x,x') = |\langle\phi(x)|\phi(x')\rangle|^2$ and its estimation by SWAP test and by inversion test, with the shot cost of each. Kernel ridge regression solved in closed form with NumPy — no scikit-learn — so that the whole pipeline is visible. Then exponential concentration: as the register grows, an expressive feature map drives every off-diagonal kernel entry towards zero, the Gram matrix becomes the identity, and learning stops being possible at all. This is demonstrated numerically, not asserted. Closes with quantum kernel ridge regression against RBF kernel ridge regression on the shared dataset under the identical protocol, reporting the result whether or not the quantum side wins, and a survey of the proposed mitigations including projected kernels.

Key topics : kernel trick · quantum kernel · SWAP and inversion tests · shot cost per Gram entry · closed-form kernel ridge · exponential concentration · Gram matrix conditioning · projected kernels

💻 7 Code Examples ⏱️ 45-50 minutes 📊 Advanced

Read Chapter 3 →

Chapter 4: Variational Quantum Models

The other main branch: a parameterized circuit trained by gradient descent. The anatomy of a variational quantum circuit — encoding layer, variational layer, measurement — and its exact correspondence with the variational eigensolver of the sister course. Parameter-shift gradients derived and implemented, with the training loop and its shot cost made explicit. Barren plateaus revisited in their machine-learning form: how depth, global measurements and entanglement each flatten the loss landscape, and what that means for a model you actually intend to train. Then generalization: a quantum model with $p$ parameters compared against a classical network with $p$ parameters on the same data and the same budget, which is a comparison the literature rarely makes. Closes with a trained VQC regressor and a NumPy MLP of matched size, with their learning curves side by side.

Key topics : VQC architecture · encoding and variational layers · parameter-shift rule · training loops and shot budgets · barren plateaus in QML · global vs local measurement · overfitting and matched-budget comparison · learning curves

💻 7 Code Examples ⏱️ 45-50 minutes 📊 Advanced

Read Chapter 4 →

Chapter 5: An Honest Assessment

Where the evidence of the previous four chapters leads. Dequantization and classical surrogates: how to tell when a quantum model's quantum-ness is load-bearing and when it is decoration, and why a surrogate does not have to be an exact simulation to demolish an advantage claim. How to read a quantum-advantage paper — benchmark hygiene, data scale, baseline strength, cherry-picking, and the specific controls whose absence should end your interest. Then the genuine positive result: with quantum data, the situation is different, and provable sample-complexity separations exist. What that means for a materials researcher who will be working with quantum sensors and quantum simulation output long before they work with a quantum learner. Closes with practical guidance on what is worth learning now — the kernel view, the encoding question, the evaluation discipline — and a summary of the series.

Key topics : dequantization · classical surrogates of quantum kernels · benchmark hygiene · cherry-picking and selective reporting · quantum data and sample-complexity separations · what to learn now · series synthesis

💻 6 Code Examples ⏱️ 45-50 minutes 📊 Advanced

Read Chapter 5 →


🔤 Notation and Shared Conventions

Fixed in Chapter 1 and used unchanged, so that code from any chapter runs with code from any other.

Symbol Meaning
$x \in [0,1]^4$ one row of the synthetic dataset: four composition-like descriptors
$y$ the target: a formation-energy-like scalar
$\lvert\phi(x)\rangle$ the state an encoding circuit prepares from a data row
$k(x,x')$ quantum kernel, $\lvert\langle\phi(x)\rvert\phi(x')\rangle\rvert^2$
$\lambda$ ridge penalty, always selected on training rows only: leave-one-out in Chapter 1, five-fold from Chapter 2 onward, a 30/10 validation split for Chapter 4's iterative training
$S$ number of measurement shots; standard error of an expectation value is at most $1/\sqrt{S}$
$p$ trainable parameter count, the quantity that must match across a comparison
CC, CQ, QC, QQ quadrant labels: first letter is the data, second is the processing
$X, Y, Z, H$, CNOT gate symbols, identical to Introduction to Quantum Computing

Qubit ordering. Qubit 0 is the leftmost and most significant bit, exactly as in the sister course. This is the opposite of Qiskit's convention.

Dataset and split. One synthetic dataset of 60 rows, generated with a fixed seed in Chapter 1's Code Example 2. Training set = the first 40 rows; test set = the last 20. Never re-drawn.

Reference numbers. The classical baseline is a test RMSE of $0.2146$ at $R^2 = 0.814$. The noise floor is $0.0507$; predicting the training mean gives $0.5242$. Every result in the series is quoted against these three numbers.


🔍 What This Series Is and Is Not

It is a methods course with every number reproduced from scratch. Every code example is plain NumPy or SciPy, every output in the text was produced by the code above it, and every comparison follows the protocol of Chapter 1.

It is not an SDK tutorial. There is no Qiskit, no PennyLane, no Cirq, no vendor account, and no cloud backend. The mini-simulator from the sister course is the only quantum interface, which keeps the physics visible instead of hiding it behind a framework whose API will have changed by the time you read this.

It is not a benchmark victory declaration. This course does not claim a quantum advantage, and it does not claim that one is impossible. It reports what its own experiments found under a stated protocol, including the experiments where the quantum model lost, and including the one where the quantum model won for entirely classical reasons.

It is not evidence about real materials data. The dataset is synthetic by design, so that every number is reproducible and no result depends on a private dataset. Conclusions here are about methods and about how to evaluate them, not about the achievable accuracy on any real property.

It is not a hardware course. Device numbers, qubit counts and vendor roadmaps appear nowhere. Where a shot budget is quoted it is quoted as arithmetic — $1/\epsilon^2$ shots per expectation value — and not as a device specification. For the physics behind those rates, read Introduction to Quantum Hardware.

📚 Recommended Learning Paths

Pattern 1: Complete path (5-6 days)

Pattern 2: The sceptic's path (half a day)

Pattern 3: The encoding path (one day)

🎯 Overall Learning Outcomes

Knowledge Level

Practical Skills

Application Ability

🛠️ Technologies and Tools Used

Main Libraries

Development Environment

🚀 Next Steps

Deep Dive Learning

Related Series

Practical Projects

⚠️ Disclaimer