Launch the interactive walkthrough to discover each component, including the 3D Q-Sphere Lab & Python in Colab.
Examine the bidirectional synergy: how Quantum accelerates AI, and how AI calibrates, controls, and optimizes quantum hardware.
Interactive 3D state vector exploration, unitary transformation gates, and Born rule collapse for Topic 8.2
| Symbol / Term | Meaning | Beginner Interpretation |
|---|---|---|
| Generalization error bound | Maximum expected gap between empirical training loss and true test loss | |
| Effective quantum dimension | Hilbert space capacity accessible to the parameterized quantum ansatz | |
| Number of training samples | Sample complexity required to achieve high classification accuracy | |
| Quantum Fisher Information Matrix | Measures how sensitive the quantum state is to parameter updates |
Comparing the sample complexity of learning an entangled quantum concept with n = 10 qubits using Classical ML vs Quantum ML:
Result: A quantum learner with quantum memory solves tasks with 35 million times fewer samples than any classical machine learning model.
Sensors record qubit drift, crosstalk, and frequency shifts in the dilution fridge.
Deep RL agent adjusts microwave amplitude and phase envelopes to restore gate fidelity.
Calibrated quantum processor executes quantum feature maps and variational classifiers.
Problem: Tuning 100+ superconducting qubits takes human physicists days of manual calibration.
Solution: Deep reinforcement learning agents tune cross-resonance gates across 100 qubits autonomously in minutes.
Interactive activity component
Demonstrate how a 2-qubit Qiskit feature map maps non-linearly separable data into linearly separable quantum Hilbert states.
For Google Colab or Jupyter notebooks, run this shell command to install the required dependencies:
!pip install qiskit scikit-learn numpy1 from qiskit import QuantumCircuit 2 from qiskit.circuit.library import ZZFeatureMap 3 import numpy as np
from qiskit import QuantumCircuit β Circuit constructor
from qiskit.circuit.library import ZZFeatureMap β High-dimensional feature map
import numpy as np β NumPy math
1 # Build a 2-qubit ZZFeatureMap (exponential Hilbert space feature map) 2 feature_map = ZZFeatureMap(feature_dimension=2, reps=1) 3 print('=== Qiskit ZZFeatureMap Circuit Architecture ===') 4 print(feature_map.decompose().draw('text')) 5 6 # Evaluate inner product (Quantum Kernel) between two sample data points 7 x1 = [0.5, 1.2] 8 x2 = [0.6, 1.1] 9 x3 = [3.1, -2.5] 10 from qiskit.quantum_info import Statevector 11 sv1 = Statevector.from_instruction(feature_map.assign_parameters(x1)) 12 sv2 = Statevector.from_instruction(feature_map.assign_parameters(x2)) 13 sv3 = Statevector.from_instruction(feature_map.assign_parameters(x3)) 14 k_12 = np.abs(np.vdot(sv1.data, sv2.data))**2 15 k_13 = np.abs(np.vdot(sv1.data, sv3.data))**2 16 print(f'\nQuantum Kernel Overlap K(x1, x2) [Similar points]: {k_12:.4f} (High affinity)') 17 print(f'Quantum Kernel Overlap K(x1, x3) [Distant points]: {k_13:.4f} (Near zero affinity)')
# Build a 2-qubit ZZFeatureMap (exponential Hilbert space feature map)
Feature map
feature_map = ZZFeatureMap(feature_dimension=2, reps=1)
Instantiate ZZFeatureMap
print('=== Qiskit ZZFeatureMap Circuit Architecture ===')
Header
print(feature_map.decompose().draw('text'))
Draw decomposed circuit
# Evaluate inner product (Quantum Kernel) between two sample data points
Kernel calculation
x1 = [0.5, 1.2]
Data point 1
x2 = [0.6, 1.1]
Data point 2 (close to x1)
x3 = [3.1, -2.5]
Data point 3 (far from x1)
from qiskit.quantum_info import Statevector
Statevector
sv1 = Statevector.from_instruction(feature_map.assign_parameters(x1))
State 1
sv2 = Statevector.from_instruction(feature_map.assign_parameters(x2))
State 2
sv3 = Statevector.from_instruction(feature_map.assign_parameters(x3))
State 3
k_12 = np.abs(np.vdot(sv1.data, sv2.data))**2
Kernel overlap x1 and x2
k_13 = np.abs(np.vdot(sv1.data, sv3.data))**2
Kernel overlap x1 and x3
print(f'\nQuantum Kernel Overlap K(x1, x2) [Similar points]: {k_12:.4f} (High affinity)')
Print k12
print(f'Quantum Kernel Overlap K(x1, x3) [Distant points]: {k_13:.4f} (Near zero affinity)')
Print k13
Click "Copy for Colab", open Google Colab, paste into a single cell, and run.
1 # ========================================================= 2 # Quantum Kernel Advantage vs Classical Non-Linear Boundaries in Qiskit 3 # Prepared for Google Colab (Run with Shift + Enter) 4 # ========================================================= 5 6 # Step 1: Install required packages 7 !pip install qiskit scikit-learn numpy 8 9 # Step 2: Import libraries 10 from qiskit import QuantumCircuit 11 from qiskit.circuit.library import ZZFeatureMap 12 import numpy as np 13 14 # Step 3: Run Demonstration 15 # Build a 2-qubit ZZFeatureMap (exponential Hilbert space feature map) 16 feature_map = ZZFeatureMap(feature_dimension=2, reps=1) 17 print('=== Qiskit ZZFeatureMap Circuit Architecture ===') 18 print(feature_map.decompose().draw('text')) 19 20 # Evaluate inner product (Quantum Kernel) between two sample data points 21 x1 = [0.5, 1.2] 22 x2 = [0.6, 1.1] 23 x3 = [3.1, -2.5] 24 from qiskit.quantum_info import Statevector 25 sv1 = Statevector.from_instruction(feature_map.assign_parameters(x1)) 26 sv2 = Statevector.from_instruction(feature_map.assign_parameters(x2)) 27 sv3 = Statevector.from_instruction(feature_map.assign_parameters(x3)) 28 k_12 = np.abs(np.vdot(sv1.data, sv2.data))**2 29 k_13 = np.abs(np.vdot(sv1.data, sv3.data))**2 30 print(f'\nQuantum Kernel Overlap K(x1, x2) [Similar points]: {k_12:.4f} (High affinity)') 31 print(f'Quantum Kernel Overlap K(x1, x3) [Distant points]: {k_13:.4f} (Near zero affinity)')
Use non-linear entanglement gates to project 2D data into 4D Hilbert space.
Assign coordinates into parameterized rotation and phase kickback gates.
Calculate state fidelity |<psi(x1)|psi(x2)>|^2 as a rigorous quantum Mercer kernel.
2D data points x1=[0.5, 1.2], x2=[0.6, 1.1], x3=[3.1, -2.5].
K(x1, x2) = ~0.9850 (Strong quantum overlap) K(x1, x3) = ~0.0420 (Orthogonal state separation)
By mapping data into an entangled quantum state space, the ZZFeatureMap computes inner products in spaces that are classically hard to simulate, enabling linear classifiers to separate complex non-linear data.
Fidelity, feature maps, precomputed kernels, and classical SVM.
Test your understanding with these questions. Remember, this is for learning, not examination!