Preparing data for a quantum machine-learning model is less about making a dataset “quantum” and more about controlling the interface between classical data and a limited quantum circuit. This checklist helps you audit feature count, scaling, labels, leakage, batching, encoding cost, hardware constraints, and classical baselines before you train a QML model.
Overview
A hybrid quantum-classical model usually performs most data preparation with familiar Python tools, then maps a compact classical feature vector into gates, angles, amplitudes, or another circuit representation. That mapping can become the practical bottleneck. A dataset may be clean and predictive yet still be unsuitable for a particular feature map because it has too many columns, incompatible shapes, poorly scaled values, or labels that do not match the measurement output.
Use the following readiness test before opening a simulator or submitting a circuit to hardware:
- Define the task: state whether the model performs binary classification, multiclass classification, regression, clustering, or a kernel-based task.
- Fix the feature budget: decide how many input values the circuit can accept and why each feature earns a place.
- Choose a scaling contract: document the minimum and maximum range expected by the feature map.
- Separate data correctly: split data before fitting imputers, scalers, selectors, or dimensionality-reduction methods.
- Record a classical reference: compare the quantum component with a simple model using the same splits and metrics.
For a broader implementation workflow, see the hybrid quantum machine-learning pipeline guide. If your experiment uses a kernel method, the quantum kernel machine-learning tutorial provides a useful evaluation frame.
How to estimate dataset readiness
Estimate readiness by measuring four quantities: usable features, circuit inputs, encoding work, and evaluation coverage. A simple feature-to-qubit estimate is:
Required qubits ≈ number of simultaneously encoded features
This is only a planning approximation. Angle encoding may use one qubit per feature for a single encoding layer, while other strategies can represent more values through repeated rotations, amplitude preparation, data re-uploading, or additional circuit structure. Those alternatives can increase circuit depth, preprocessing complexity, or sensitivity to noise.
Estimate encoding work separately:
Encoding burden = preparation cost + circuit depth added by data encoding + shots or evaluations required
Do not treat qubit count as the only constraint. A small feature vector can still create an expensive experiment if the model requires many parameter updates, repeated circuit evaluations, or noisy hardware runs. Before training, write down:
- the number of rows in each split;
- the number of raw and retained features;
- the selected encoding method;
- the expected qubit count and circuit depth;
- the number of training iterations and circuit evaluations;
- the simulator or hardware backend used for each stage.
Backend capabilities and noise characteristics can change the practical choice. Use the quantum backend checklist and, when appropriate, the simulator comparison guide to keep the software experiment aligned with its execution target.
Inputs and assumptions: the dataset-readiness checklist
| Check | Recommended decision | Why it matters |
|---|---|---|
| Feature selection | Remove identifiers, duplicates, constant columns, and features without a defensible relationship to the task. | Every retained input can add encoding work and circuit complexity. |
| Scaling range | Choose a documented range, such as [0, π] or [-π, π], according to the feature map and rotation convention. | Unscaled values can produce inconsistent rotations or dominate the representation. |
| Dimensionality reduction | Use feature selection or a fitted reduction method when the retained features exceed the circuit budget. | Compression should be learned from training data only and validated against information loss. |
| Label encoding | Match labels to the measurement output: two classes for a binary expectation or suitable output structure for multiple classes. | Incorrect label shape can make training invalid or metrics misleading. |
| Train-test separation | Split before fitting preprocessing objects; keep the test set untouched until final evaluation. | This prevents statistics from the test set entering training. |
| Batching | Start with a small, reproducible batch plan and state whether batches are sampled class-uniformly. | Small batches can make gradient or loss estimates noisy. |
| Class imbalance | Inspect class counts and select weighted loss, resampling, or class-aware batches when justified. | Accuracy alone may conceal poor minority-class performance. |
| Data leakage | Check timestamps, duplicate records, target-derived columns, grouped entities, and preprocessing fit scope. | Leakage can make a quantum model appear better without improving generalization. |
| Encoding cost | Record circuit depth, number of encoded values, and evaluations per training step. | A model that fits in simulation may be impractical under realistic execution limits. |
| Classical baseline | Train at least one transparent classical model on the same processed splits. | It establishes whether the quantum component adds useful value. |
Scaling and preprocessing rules
Fit a scaler only on the training partition, then transform validation and test partitions with the same fitted object. Keep the transformation reproducible by storing its parameters with the experiment configuration. If the circuit expects angles, scaling into an angle range is usually clearer than passing arbitrary standardized values directly into rotation gates. The correct range depends on the feature map, so treat the range as an interface contract rather than a universal prescription.
Labels, batches, and imbalance
For binary classification, decide whether the circuit returns an expectation value, a probability, or logits derived from measured outcomes. Then choose a loss and label representation that agree with that output. For multiclass tasks, confirm that the framework and circuit return the required output shape before training.
Batching is an experimental choice, not merely a memory setting. Keep batch size, sampling seed, and class composition in the run log. When classes are uneven, report precision, recall, F1 score, balanced accuracy, or a confusion matrix alongside accuracy. Select metrics before looking at test results.
Worked examples
Example 1: Four-feature binary classifier
Suppose a tabular dataset has four numeric predictors and two labels. After removing an identifier, you scale each feature into the range required by an angle-encoding circuit. A first experiment might use four data inputs, four qubits, a shallow variational layer, and a binary expectation-value output.
The readiness record should state: the original row split, the four retained columns, training-only scaling, the label mapping, the circuit’s input order, the batch size, and the classical baseline. If a logistic regression model reaches a similar validation result with much lower evaluation cost, that is an important outcome—not a failure. It tells you where a deeper or different QML experiment must justify its added complexity.
Example 2: Twelve features but an eight-qubit budget
Here, directly assigning one feature to one qubit does not fit the planned circuit. Compare three controlled alternatives: select the eight most defensible features, reduce the twelve features to eight components using a method fitted only on training data, or use a circuit design that re-uploads data over multiple layers.
Evaluate all alternatives with the same split and baseline. Feature reduction can lower input width but may make the resulting features harder to interpret. Re-uploading can preserve more information but increases depth and may be more sensitive to noise. The choice should be recorded as an assumption and tested, not presented as a guaranteed improvement.
Example 3: Imbalanced labels
If one class is uncommon, a random batch can contain too few minority examples for stable learning. Compare ordinary batching with class-aware batches or a weighted loss, while keeping the test distribution representative of the intended use case. Report per-class results and inspect false positives and false negatives. A quantum circuit does not remove the need for ordinary dataset diagnostics.
When to recalculate
Revisit this checklist whenever the dataset, preprocessing library, QML framework, feature map, backend, or evaluation protocol changes. Recalculate the feature and qubit budget when you add columns, change dimensionality reduction, or move from a simulator to hardware. Recheck input shapes and measurement outputs after upgrading a framework or changing circuit templates, because integration details are version-sensitive.
Before each new run, complete this short release check:
- Export the exact train, validation, and test split identifiers.
- Save the fitted preprocessing parameters and feature order.
- Confirm the circuit input shape, qubit count, depth, and measurement output.
- Run a small batch through the full pipeline before training.
- Compare against the same classical baseline and metrics.
- Log encoding cost, execution backend, seeds, and failure cases.
Finally, distinguish data readiness from quantum advantage. A clean, compatible dataset makes a QML experiment interpretable; it does not guarantee superior accuracy or lower cost. For the next stage, review the circuit optimization guide, and use the quantum circuit debugging workflow when results diverge between preprocessing, simulation, and hardware execution.