A variational quantum classifier (VQC) is a quantum machine learning
model that combines data encoding (feature map), a parameterized quantum
circuit (ansatz), and measurement to perform binary or multi-class
classification. The model is trained using gradient-based optimization.
This implementation follows the circuit-centric quantum classifier
approach of Schuld et al. (2018, arXiv:1804.00633) and the broader
variational quantum algorithm (VQA) paradigm. For multi-class problems,
it uses a one-vs-rest (OvR) strategy.
The training process:
1. Encode classical data into quantum states using the feature map
2. Apply parameterized ansatz circuit
3. Measure expectation value (typically Pauli-Z on first qubit)
4. Minimize binary cross-entropy loss via gradient descent
The gradients are computed using the parameter shift rule, which
provides exact gradients on quantum hardware (Mitarai et al., 2018,
arXiv:1803.00745).
Parameters:
n_qubits (int, default=4) – Number of qubits.
feature_map (FeatureMap, optional) – Data encoding. Default: AngleFeatureMap()
A support vector machine that uses a quantum kernel to implicitly
map data into a high-dimensional quantum feature space. The kernel
is computed as the fidelity (squared inner product) between quantum-
encoded states, following the quantum kernel method of Havlíček et al.
(2019, arXiv:1904.01567).
The implementation:
1. Encodes data using a quantum feature map
2. Computes the quantum kernel matrix (Gram matrix)
3. Trains a classical SVM with precomputed kernel
This hybrid approach leverages quantum computers to generate kernel
matrices that may be classically intractable to compute, while using
well-established classical SVM training.
Parameters:
n_qubits (int, default=4) – Number of qubits for the quantum circuit.
feature_map (FeatureMap, optional) – Quantum feature map for data encoding. Default: AngleFeatureMap()
device (str, default="default.qubit") – PennyLane device for simulation.
C (float, default=1.0) – Regularization parameter. The strength of regularization is
inversely proportional to C.
shrinking (bool, default=True) – Whether to use the shrinking heuristic.
probability (bool, default=False) – Whether to enable probability estimates.
tol (float, default=1e-3) – Tolerance for stopping criterion.
cache_size (float, default=200) – Kernel cache size in MB.
class_weight (dict or "balanced", optional) – Class weights for imbalanced datasets.
Configure whether metadata should be requested to be passed to the fit method.
Note that this method is only relevant when this estimator is used as a
sub-estimator within a meta-estimator and metadata routing is enabled
with enable_metadata_routing=True (see sklearn.set_config()).
Please check the User Guide on how the routing
mechanism works.
The options for each parameter are:
True: metadata is requested, and passed to fit if provided. The request is ignored if metadata is not provided.
False: metadata is not requested and the meta-estimator will not pass it to fit.
None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.
str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (sklearn.utils.metadata_routing.UNCHANGED) retains the
existing request. This allows you to change the request for some
parameters and not others.
Added in version 1.3.
Parameters:
sample_weight (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for sample_weight parameter in fit.
A variational quantum model for regression tasks that uses a quantum
circuit to map inputs to continuous outputs. The model is trained
to minimize mean squared error (MSE) using gradient-based optimization.
The implementation follows the variational quantum algorithm (VQA)
paradigm where:
1. Classical features are encoded into quantum states (feature map)
2. A parameterized ansatz circuit processes the encoded states
3. Measurement (typically Pauli-Z expectation) provides continuous output
4. The target variable is scaled to match the measurement range [-1, 1]
5. Gradients computed via parameter shift rule optimize the parameters
This approach extends quantum neural networks to regression tasks
as described in Schuld et al. (2018, arXiv:1804.00633) and
Mitarai et al. (2018, arXiv:1803.00745).
Parameters:
n_qubits (int, default=4) – Number of qubits in the quantum circuit.
feature_map (FeatureMap, optional) – Data encoding circuit. Default: AngleFeatureMap()