AI Engineering
AwesomeOps: Quantum Machine Learning Part 4 of 4
Series
AwesomeOps Quantum Machine Learning Part 4 of 4
Stack
Python 3.11.5, scikit-learn, Qiskit, Qiskit Machine Learning
Result
QSVC test score: 0.6228070175438597
A Practical Quantum Machine Learning Demo
This final post in the series moves from theory into implementation with a simple Quantum Support Vector Classifier (QSVC) demo. For speed, the walkthrough uses a simulator instead of submitting jobs to IBM quantum hardware.
That choice is pragmatic rather than dismissive. Public IBM quantum resources can involve long queue times, so a simulator is the fastest way to explore the workflow, validate the code, and understand the concepts before graduating to real hardware.
If you do want to run against IBM resources, the only added prerequisite is an IBM Quantum Platform account and API token from your dashboard.
- Simulator-based demo for faster iteration and reproducible local testing.
- IBM hardware and IBM-hosted simulator options are still shown in the code.
- The example uses only the first two features of the dataset to keep the demo lightweight.
Environment Setup
The original demo was run with Python 3.11.5, and results may vary with different package or Python versions.
Before running the script, install the required packages below.
pip install scikit-learn qiskit qiskit-machine-learning qiskit-ibm-provider qiskit-aerQuantum Machine Learning Demo Code
The following script loads a small classification dataset, standardizes the selected features, constructs a quantum kernel, trains a QSVC model, and prints the test score.
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from qiskit import Aer
from qiskit.utils import QuantumInstance
from qiskit.circuit.library import ZZFeatureMap
from qiskit_machine_learning.kernels import QuantumKernel
from qiskit_machine_learning.algorithms import QSVC
from qiskit_ibm_provider import IBMProvider
def main():
# Load IBM Quantum Platform account using qiskit_ibm_provider
provider = IBMProvider('IBM_API_KEY')
random_seed = 69543
# Load Breast Cancer dataset and preprocess
cancer = datasets.load_breast_cancer()
# Select first two features for simplicity
X = cancer.data[:, :2]
y = cancer.target
# Standardize the data
scaler = StandardScaler()
X = scaler.fit_transform(X)
# Split dataset into training and testing sets
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=random_seed, shuffle=True)
# Choose one of the 3 options below:
# Option 1: Below is an actual IBM Quantum device. You will need and API key set for this.
# backend = provider.get_backend('ibm_perth')
# Option 2: Below is a IBM simulator. You will need and API key set for this.
# backend = provider.get_backend('ibmq_qasm_simulator')
# Option 3: Below is a simulator that runs on your local machine
backend = Aer.get_backend('qasm_simulator')
# Create QuantumInstance
quantum_instance = QuantumInstance(backend, shots=1024, seed_simulator=random_seed, seed_transpiler=random_seed)
# Quantum Feature Map and Kernel
feature_map = ZZFeatureMap(feature_dimension=2)
kernel = QuantumKernel(feature_map=feature_map, quantum_instance=quantum_instance)
# QSVC
qsvc = QSVC(quantum_kernel=kernel)
qsvc.fit(X_train, y_train)
# Predict and score
score = qsvc.score(X_test, y_test)
print(f"QSVC Test score: {score}")
if __name__ == "__main__":
main()Step-by-Step Breakdown
What the Score Means
In the original run, the script returned a test score of 0.6228070175438597. Interpreted plainly, that means the model achieved roughly 62% accuracy on the held-out test data for this specific run.
That number should be treated as a starting point rather than a final conclusion. The example intentionally uses only two features, one run, and a simple simulator-based setup.
Results can change with feature selection, parameter tuning, shot count, model iteration, or a larger and different dataset.
Reported accuracy
62.28%
Derived from the original reported QSVC test score of 0.6228070175438597.
Series Wrap-Up
This final article ties the series together by showing how the fundamentals, limitations, and promise of quantum machine learning translate into an executable example.
The broader Mentat view is that quantum systems may eventually help accelerate AI training and model updates, reducing workflows that currently take hours or days down to minutes.
Even with today's constraints, the value of the series is practical: it shows readers how to start experimenting now with the tools already available.
At Mentat, we are conducting research to discover ways to use quantum computers to train our AI models more efficiently. The goal is to train models in a matter of a few minutes, rather than hours or days, so client models can be updated in a practical time frame.
Original Series Links

Key takeaway
Ready to automate smarter?
Quantum machine learning is still early, but even a small QSVC demo shows how quantum kernels, classical preprocessing, and simulator-based experimentation can be combined into a working end-to-end workflow today.