Quantum Data Encoding Methods: How to Choose a Feature Map for QML
quantum machine learningquantum data encodingfeature mapsquantum circuitsPennyLane

Quantum Data Encoding Methods: How to Choose a Feature Map for QML

CCoqBit Labs
2026-11-08
7 min read

Compare quantum data encoding methods and estimate qubits, depth, measurements, and preprocessing before choosing a QML feature map.

Choosing a quantum data encoding method is a modeling decision, not a cosmetic circuit choice. This guide compares basis, angle, amplitude, and Hamiltonian encoding, then gives you a repeatable way to estimate qubit use, circuit depth, parameter count, measurement cost, and likely preprocessing effort before running a QML experiment.

Overview

A quantum machine-learning feature map converts classical input data into a quantum state or into the parameters of a quantum circuit. The circuit can then apply trainable operations and measurements to produce predictions, similarities, or an optimization objective.

There is no universally best encoding. The right method depends on the shape of the dataset, the number of available qubits, the data range, the target hardware, and the amount of noise and sampling you can tolerate. A compact encoding may reduce qubit requirements while increasing circuit depth or preprocessing complexity. A simple encoding may be easier to debug but use one qubit per feature or discard useful structure during feature selection.

For software engineers, it helps to treat a feature map as an interface with measurable resource costs:

  • Input contract: What values, ranges, sparsity, and dimensions does the circuit accept?
  • State-loading cost: How many gates and layers are needed to represent one data point?
  • Trainability: Does the encoding preserve distinctions between examples without making optimization unstable?
  • Measurement cost: How many observables and circuit repetitions are needed for a useful estimate?
  • Deployment fit: Can the circuit be transpiled to the intended simulator or device within its connectivity and depth limits?

Encoding is only one part of a QML pipeline. Compare complete experiments against a classical baseline, and avoid interpreting a lower qubit count as an automatic advantage.

How to estimate

Start by writing down the dataset dimensions and the target circuit budget. Let d be the number of features after preprocessing, q the number of qubits, L the number of encoding repetitions, and S the number of measurement shots per circuit evaluation. Then estimate the following quantities before implementing the model.

Qubit count

Basis encoding commonly uses a qubit for each binary feature, although multiple classical bits can be packed into fewer qubits with additional logic. Angle encoding usually requires one qubit per encoded scalar in its simplest form, so a dataset with d features often begins with q ≈ d. Amplitude encoding represents a vector in the amplitudes of a quantum state and can represent up to 2q components with q qubits. The relationship is therefore approximately q = ceil(log2(d)) for a padded vector, but state preparation can be substantially more involved.

Hamiltonian or observable-based encoding does not have one universal qubit formula. The qubit count is determined by the physical or abstract system represented by the Hamiltonian and by how the data coefficients enter its terms.

Depth and parameter count

For angle encoding, a first estimate is the number of encoding repetitions multiplied by the number of features, plus the entangling and trainable layers. If every feature is encoded in every repetition, the number of data-dependent rotation parameters is roughly d × L. This is a planning estimate, not a hardware-level depth guarantee: transpilation, gate decomposition, and connectivity can add operations.

Amplitude encoding may reduce q but require a state-preparation circuit whose depth depends on the preparation method and the structure of the input vector. Sparse or structured vectors may be cheaper than arbitrary dense vectors, but that should be measured rather than assumed. For any candidate map, record both logical depth and transpiled depth for the selected backend.

Measurement cost

If a model evaluates M observables with S shots per observable, a simple first-order estimate is M × S circuit samples per forward evaluation. If the optimizer performs E evaluations across R training rounds, the sampling workload is approximately E × R × M × S, before accounting for gradient evaluations or repeated validation runs. This estimate lets you compare a shallow map with many measurements against a deeper map with a smaller readout.

Feature-map selection table

MethodInput preparationQubit estimateMain cost or riskGood starting use
BasisConvert discrete or binary values into computational-basis statesOften related to the number of encoded bitsRequires discretization; can represent limited value structure directlyBinary features, demonstrations, and logic-oriented circuits
AngleScale features into rotation anglesOften one qubit per feature per parallel groupFeature scaling and repeated layers affect depthLow-dimensional continuous data and first benchmarks
AmplitudeNormalize a vector and load it into state amplitudesApproximately logarithmic in vector lengthState preparation can dominate depth and noiseCompact simulations or structured, carefully prepared vectors
HamiltonianPlace data in coefficients or terms of an operatorProblem-dependentRequires domain modeling and observable designPhysics-inspired models and energy or optimization objectives

Inputs and assumptions

Before comparing feature maps, create a preprocessing record for every dataset version.

  1. Feature count and type: Separate continuous, ordinal, categorical, binary, and missing-value fields. Do not feed category identifiers into a rotation as though they were measurements on a meaningful numeric scale.
  2. Range and normalization: Record the transformation applied to each feature. Angle encoding needs a defined mapping from the feature range to rotation angles. Amplitude encoding requires a normalized vector, with padding if the length is not compatible with the chosen state dimension.
  3. Dimension reduction: If d exceeds the qubit budget, specify whether you will select features, aggregate them, or use a classical projection. Fit that transformation only on the training split to avoid leakage.
  4. Data ordering: Document which feature maps to which qubit, rotation axis, amplitude position, or Hamiltonian coefficient. A silent ordering change can make two experiments appear comparable when they are not.
  5. Noise and backend assumptions: Distinguish ideal simulation, noisy simulation, and hardware execution. A map that works at low logical depth may become impractical after routing and gate decomposition.
  6. Baseline and split: Keep the train, validation, and test split fixed across encoding comparisons. Include a classical model with a similar preprocessing budget.

Framework APIs change, so confirm the current feature-map classes and device constraints in the documentation for your chosen tool. A PennyLane variational-circuit tutorial can help with an implementation workflow, while the quantum circuit transpilation guide is useful when logical estimates must be translated into backend-specific resources.

Worked examples

Example 1: Twelve scaled continuous features

Suppose a classifier has 12 continuous features, each scaled to a documented interval. An angle-encoding trial might use 12 qubits, one encoding layer, and two trainable layers. Its initial data-loading estimate is 12 rotation operations per example, before entangling gates and transpilation. This is a practical baseline because the input contract is straightforward and individual features remain easy to trace.

If the hardware target cannot support 12 useful qubits at the required depth, project the data to four components and compare a four-qubit angle map against a four-qubit amplitude map. The amplitude version may represent the projected vector with fewer qubits, but its state-preparation circuit must be included in the depth and runtime measurement. Do not compare only the abstract number of qubits.

Example 2: Binary features

For eight binary inputs, basis encoding is a natural control experiment. It preserves the discrete interpretation of each input, but it may not express graded similarity between examples without additional circuit design. An angle version can map zero and one to selected rotation values and may integrate more easily with a variational ansatz. Run both with the same optimizer, split, evaluation budget, and measurement definition.

Experiment record

Use a table or machine-readable log with one row per encoding and dataset version. At minimum, record:

encoding: angle | basis | amplitude | Hamiltonian
dataset_version: ...
raw_features: ...
encoded_features: ...
qubits: ...
encoding_layers: ...
trainable_parameters: ...
logical_depth: ...
transpiled_depth: ...
observables: ...
shots_per_observable: ...
training_evaluations: ...
validation_score: ...
test_score: ...
runtime_or_resource_notes: ...

Repeat each meaningful comparison with the same evaluation protocol. Report variability across runs when optimization is stochastic, and inspect training behavior rather than relying on one final score. Circuit debugging practices from the quantum circuit debugging guide can help isolate whether a result comes from preprocessing, the feature map, the ansatz, or measurement code.

When to recalculate

Recalculate your encoding choice whenever an input to the resource estimate changes. The most important triggers are a new feature count, a different normalization or dimensionality-reduction step, a new ansatz, a different observable set, or a change from ideal simulation to noisy simulation or hardware.

Also revisit the estimate after a framework release changes supported feature-map implementations, default decompositions, differentiation behavior, or device integrations. Hardware targets should be reassessed when connectivity, native gates, queue conditions, or execution limits change. These details can alter transpiled depth and measurement cost even when the mathematical circuit is unchanged.

For a repeatable workflow, keep a small benchmark suite with representative datasets and run it whenever the QML library, backend, preprocessing pipeline, or model architecture changes. Start with angle encoding as a transparent baseline when the feature dimension is manageable; test basis encoding for discrete inputs, amplitude encoding when state preparation is demonstrably acceptable, and Hamiltonian encoding when the problem has a meaningful operator formulation. Choose the method that meets the complete accuracy, depth, measurement, and engineering budget—not the method with the smallest qubit count on paper.

For broader implementation choices, compare the capabilities of Qiskit, Cirq, and PennyLane, and review the quantum hardware access guide before committing a feature map to a real-device experiment.

Related Topics

#quantum machine learning#quantum data encoding#feature maps#quantum circuits#PennyLane
C

CoqBit Labs

Quantum Computing Editors

Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.