Encoding classical data into quantum states

Intermediate Quantum Machine Learning
Created by Pavel · 17.03.2026 at 07:05 UTC

Classical vectors become quantum states through deliberate encoding choices: basis labels for discrete data, amplitudes subject to normalisation, or rotation angles on the Bloch sphere. Each choice trades interpretability against preparation cost.

Angle encoding that only applies $R_z$ without creating superposition leaves Z-measurement statistics unchanged—a common student trap when checking whether data actually entered the model.

University approvals: 0
Tasks
Question 1

Which encoding maps a binary string directly to a computational-basis state such as $01 \mapsto |01\rangle$?

Hint

Choose the most literal encoding of a bitstring.

Question 2

Which statement best describes the main attraction of amplitude encoding?

Hint

Think about compact storage versus preparation cost.

Question 3

What condition must a classical vector satisfy before it can be used directly as amplitudes of a quantum state?

Hint

A quantum state must have total probability 1.

Question 4

In angle encoding, where do classical features usually appear?

Hint

Look at one-qubit rotation gates.

Question 5

Implement amplitude_squared_norm(values: list[float]) -> float returning $\sum_i x_i^2$ (used to check whether a real vector can be turned into amplitudes before normalisation).

Hint

Sum squares in a loop or with comprehension.

Starter code is prefilled; replace TODO blocks with your solution.
2 test cases will be used for grading
Run checks runtime behavior only. Final correctness is evaluated when you submit.
Card Info
  • Topic: Quantum Machine Learning
  • Difficulty: Intermediate
  • Completed: 0 users
Creator
Pavel
Pavel