Computing Library › Quantum Ml
Quantum Ml

Angle Encoding

Angle encoding writes each feature into a qubit rotation angle, giving a shallow, hardware-friendly embedding that dominates near-term quantum machine learning.

One feature, one rotation

Angle encoding maps each classical feature x_i to a rotation angle on a qubit, for example applying RY(x_i) or RZ(x_i) to qubit i starting from a Hadamard-prepared superposition. With one feature per qubit the circuit depth is constant regardless of feature values, which is why angle encoding is the workhorse of near-term data loading.

Capacity and reuse

Kronos motion — lego machine

The plain scheme needs as many qubits as features, so it does not offer the exponential compression of amplitude encoding. To fit more features than qubits, or to raise expressivity, features are re-encoded across multiple layers, a technique called data re-uploading. Each re-upload adds Fourier frequencies to the reachable function class, as described in encoding expressivity.

python
# Angle encoding of a feature vector (schematic)
def angle_encode(x):
    for i, xi in enumerate(x):
        qml.Hadamard(wires=i)
        qml.RY(xi, wires=i)   # feature enters as a rotation angle
# Depth is constant in the feature magnitudes; qubits = number of features.

Preprocessing that matters

Strengths and weaknesses

The strength is practicality: shallow circuits, native gates, robustness to noise, and easy differentiation via the parameter-shift rule. The weakness is capacity: without re-uploading the model sees each feature only through a single sinusoid, limiting the functions it can represent. In practice angle encoding with a few re-upload layers is a sensible default for variational models on today's machines.

As with every encoding, the choice shapes the model's inductive bias. The rotation basis (X, Y, or Z), the pattern of entangling gates that follow, and the number of re-uploads together determine which functions of the data the circuit can even express, before any training begins.