QubitLab
IDELearnPlaygroundDocsCommunity
Log in
QubitLab
IDELearnPlaygroundDocsCommunity
Log in
QubitLab
IDELearnPlaygroundDocsCommunity
Log in
HomeLearnCatalogRanksPlaygroundDocs
04 · Data encoding0%

You are reading without signing in. Sign in or continue as guest to take quizzes and climb the ranks.

Learn/QC 302Cutting and Quantum ML·Lesson 4 of 7

Data encoding

Basis, angle and amplitude encoding: how classical data enters a circuit and what each choice costs.

Advanced10 min read4 sections · 2 questions+45
By the end you will be able to
  1. 01Encode a 4-dimensional vector three different ways.
  2. 02Compare qubit count and circuit depth per encoding.
  3. 03Explain why encoding dominates many QML costs.
EncodingQubits for N featuresDepthNote
BasisN (bits)1x = 0101 → |0101⟩; only for binary data
AngleN1feature xᵢ → ry(xᵢ) on qubit i; simple and hardware-friendly
Amplitudelog₂ NO(N)x becomes the statevector itself; exponentially compact, exponentially deep to prepare
Hands-on

Angle-encode (0.3, 1.2, 2.0, 0.7)

Four features, four qubits, one layer. The Bloch view shows each qubit tilted by its feature. Add a second layer of CNOTs and RYs to see how a feature map creates correlations the model can use.

OpenQASM 3
OPENQASM 3.0;
include "stdgates.inc";
qubit[4] q;
ry(0.3) q[0];
ry(1.2) q[1];
ry(2.0) q[2];
ry(0.7) q[3];
Sign in to run (nothing is saved)
Open in the IDE Open in the Playground
Knowledge check

2 questions · one try each counts

Question 1

Amplitude encoding of 1024 features needs how many qubits?

Sign in to answer and climb the ranks; you will come back to this lesson.

Question 2

Which statement about QML speed-ups is honest?

Sign in to answer and climb the ranks; you will come back to this lesson.

Key takeaway

Angle encoding is cheap and shallow, amplitude encoding is compact but deep. Always count the cost of getting data in before believing a speed-up.

Finished reading?

Knowledge check: 2 questions waiting above. Questions are optional. Mark it complete, or press Next: moving on marks it complete too.

Up next
Lesson 5 · 14 min
Hands-On 2-Qubit Variational Classifier
Encode a point with two RX gates, entangle, rotate with one trainable RY, and tune θ until the two classes separate.
Further reading
  • Docs: encodings and feature maps
More in Cutting and Quantum ML
  • Circuit cutting
  • Classical ML vs. Quantum ML: The Hybrid Loop
  • Variational circuits
Variational circuitsHands-On 2-Qubit Variational Classifier
In this lesson0%
  1. Introduction
  2. Try it: Angle-encode (0.3, 1.2, 2.0, 0.7)
  3. Knowledge check
  4. Key takeaway
QubitLab
IDELearnPlaygroundDocsCommunity
Log in
QubitLab
IDELearnPlaygroundDocsCommunity
Log in