Este repositório contém o código-fonte, os scripts de análise e de geração de gráficos, e os resultados consolidados deste README do Trabalho de Conclusão de Curso em Engenharia de Software pelo Instituto Nacional de Telecomunicações (Inatel), defendido e aprovado em junho de 2026. Os arquivos brutos de execução e imagens geradas permanecem fora do Git por volume e podem ser reproduzidos pelos scripts.
O trabalho investiga, de forma experimental e reprodutível, o desempenho de dois paradigmas de aprendizado de máquina quântico — Variational Quantum Circuits (VQC) e Quantum Kernel (QKernel) — em classificação binária sobre dados tabulares na era NISQ. Os resultados são comparados com SVMs clássicas e validados em hardware quântico real da IBM (IBM Marrakesh).
A investigação foi estruturada em três etapas progressivas, descritas abaixo com seus respectivos resultados.
Objetivo: Identificar qual combinação de encoding e pré-processamento maximiza o desempenho do VQC sob ruído despolarizante parametrizado.
Configuração experimental:
- 4 estratégias de encoding: OA (RX+RY sem re-upload), OB (RX+RZ sem re-upload), RA (RX+RY com re-upload), RB (RX+RZ com re-upload)
- 2 pipelines de pré-processamento: MM (MinMaxScaler) e SSKMM (StandardScaler → SelectKBest(k=nq) → MinMaxScaler)
- 5 níveis de ruído despolarizante: p ∈ {0,000; 0,001; 0,005; 0,010; 0,050}
- 2 e 4 qubits, L=2 camadas, 20 épocas, 5-fold CV estratificado
- 1.200 execuções VQC no total, em 4 plataformas (Mac M1, Dell, Raspberry Pi, Windows/Nitro)
Acurácia média por configuração (consolidada sobre 5 folds × 5 níveis de ruído × 3 datasets, n=75):
| Qubits | Encoding | Pré-processamento | Acurácia média | DP |
|---|---|---|---|---|
| 2 | OA | MM | 0,866 | 0,080 |
| 2 | OA | SSKMM | 0,916 | 0,077 |
| 2 | OB | MM | 0,904 | 0,076 |
| 2 | OB | SSKMM | 0,952 | 0,053 |
| 4 | OA | MM | 0,876 | 0,086 |
| 4 | OA | SSKMM | 0,906 | 0,078 |
| 4 | OB | MM | 0,889 | 0,079 |
| 4 | OB | SSKMM | 0,913 | 0,061 |
As configurações com re-upload (RA, RB) não superaram as sem re-upload em nenhuma combinação avaliada.
Principais achados:
- O pré-processamento SSKMM foi o fator de maior impacto — superou MM em quase todas as configurações (p < 0,001, teste t pareado, d de Cohen até 0,84)
- O encoding RX+RZ sem re-upload (OB) apresentou desempenho igual ou superior ao RX+RY em todas as comparações
- O data re-upload não produziu ganhos mensuráveis nos datasets avaliados, adicionando profundidade de circuito sem benefício preditivo
- A acurácia se manteve robusta ao ruído despolarizante na faixa investigada (p ≤ 0,05); o custo do ruído manifestou-se no tempo de simulação, não na acurácia
Objetivo: Comparar VQC, QKernel e SVMs clássicas sob ruído calibrado de hardware real, avaliando desempenho preditivo e custo computacional.
Configuração experimental:
- Backend: FakeBrisbane (127 qubits, ruído calibrado com T1/T2 e gate errors reais)
- Algoritmos: VQC origB (RX+RZ sem re-upload), VQC encB (com re-upload), QKernel (ZZFeatureMap + SVC), SVM-Linear, SVM-RBF
- Métricas: AUC, acurácia, F1-score + custo computacional (energia do host, Cinf, Ctreino, Cvol)
- 5-fold CV estratificado, pipeline SSKMM, 4 qubits
AUC média por algoritmo e dataset (5-fold CV, FakeBrisbane):
| Algoritmo | Iris | Wine | Breast Cancer |
|---|---|---|---|
| SVM-Linear | 1,000 ± 0,000 | 0,995 ± 0,011 | 0,988 ± 0,010 |
| SVM-RBF | 1,000 ± 0,000 | 0,998 ± 0,005 | 0,985 ± 0,014 |
| VQC origB | 1,000 ± 0,000 | 0,992 ± 0,010 | 0,987 ± 0,009 |
| VQC encB | 0,997 ± 0,005 | 0,988 ± 0,010 | 0,979 ± 0,013 |
| QKernel | 0,942 ± 0,054 | 0,847 ± 0,067 | 0,929 ± 0,015 |
Principais achados:
- VQC origB igualou o SVM clássico em AUC — nenhuma diferença estatisticamente significativa após correção de Holm-Bonferroni (p_adj > 0,05, Wilcoxon pareado, n=15 pares)
- QKernel apresentou AUC significativamente inferior a todos os demais algoritmos (p_adj = 0,0007), com profundidade de circuito d=38 operando em região de risco de decoerência (tcircuito/T2,min = 0,187)
- O custo de inferência do QKernel é O(n²) — inviável para conjuntos maiores sem técnicas de aproximação (ex.: Nyström)
- SVM-Linear foi a âncora da fronteira de Pareto desempenho×custo em todos os datasets
Objetivo: Avaliar a transferibilidade do VQC treinado em simulador para execução em hardware quântico físico, quantificando a lacuna simulação–real.
Configuração experimental:
- Dataset: Wine, fold 0 (26 amostras de teste)
- Treinamento: FakeBrisbane e FakeMarrakesh (100 épocas, η=0,05, 512 shots)
- Inferência: IBM Marrakesh (processador supercondutor, 156 qubits) — pesos transferidos diretamente sem re-treinamento
- 512 shots por amostra, sem técnicas de mitigação de erros
Desempenho por backend (Wine fold 0, n=26 amostras):
| Backend | Acurácia (teste) | AUC (teste) | F1 (teste) |
|---|---|---|---|
| FakeBrisbane | 1,000 | 1,000 | 1,000 |
| FakeMarrakesh | 1,000 | 1,000 | 1,000 |
| IBM Marrakesh (real) | 0,962 | 1,000 | 0,961 |
| Δ (real − simulador) | −0,038 | 0,000 | −0,039 |
Principais achados:
- AUC preservada em 1,000 no hardware real — a separabilidade das classes não foi comprometida pelo ruído físico
- O único erro introduzido pelo hardware real concentrou-se na amostra de menor margem ao limiar de decisão (⟨Z₀⟩ = −0,129 no simulador → −0,028 no hardware, Δ = +0,101, aproximadamente 2,4× superior ao deslocamento médio)
- FakeMarrakesh demonstrou ser proxy mais fiel ao IBM Marrakesh do que FakeBrisbane (deslocamento médio absoluto 0,037 vs 0,044)
- A análise de margem ao limiar de decisão identificou corretamente a amostra vulnerável antes da execução no hardware real — potencial critério preventivo de robustez
Nota sobre poder estatístico: Com n=26 amostras e um único fold, os resultados da Etapa 3 são evidência descritiva de viabilidade operacional, não prova estatística de equivalência entre simulador e hardware real. O teste de McNemar requer b+c ≥ 5 discordâncias para aproximação válida; apenas 1 foi observada.
qml-tabular-study/
│
├── stage1_vqc_encoding/ # Etapa 1: 1.200 execuções, 4 encodings, 5 níveis de ruído
│ ├── src/
│ │ ├── vqc_orig*.py # VQCs sem data re-upload
│ │ ├── vqc_enc*.py # VQCs com data re-upload
│ │ └── configs/ # Configurações das máquinas experimentais
│ ├── analysis/ # Análises estatísticas da etapa
│ └── plots/ # Gráficos de acurácia, ruído e comparações
│
├── stage2_vqc_vs_qkernel/ # Etapa 2: VQC vs QKernel vs SVM (FakeBrisbane)
│ ├── src/ # Experimentos VQC, QKernel e SVM
│ ├── analysis/ # Desempenho, custo, ruído e escalabilidade
│ └── plots/ # Fronteira de Pareto, profundidade de circuito, AUC
│
├── stage3_real_hardware/ # Etapa 3: Inferência no IBM Marrakesh (QPU real)
│ ├── src/ # Simulações FakeBrisbane/FakeMarrakesh e execução real
│ ├── analysis/ # Análise da lacuna simulador–hardware
│ └── plots/ # Deslocamento de decision score, esfera de Bloch
│
└── requirements.txt
| Dataset | N | Features | Classes (binarizadas) | Balanço |
|---|---|---|---|---|
| Iris | 100 | 4 | setosa vs versicolor | 50/50 |
| Wine | 130 | 13 | classe 0 vs classe 1 | 59/71 |
| Breast Cancer Wisconsin | 569 | 30 | maligno vs benigno | 212/357 |
Fonte: UCI Machine Learning Repository
# Clone o repositório
git clone https://github.com/fredericowlassow/qml-tabular-study.git
cd qml-tabular-study
# Instale as dependências
python3 -m pip install -r requirements.txt
# Etapa 1 — exemplo: VQC origB com SSKMM
python3 stage1_vqc_encoding/src/vqc_origB_sskmm.py
# Etapa 2 — comparação VQC vs QKernel (FakeBrisbane)
python3 stage2_vqc_vs_qkernel/src/qml_nitro_origB_brisbane_v6.py
# Etapa 3 — inferência no hardware real (requer token IBM Quantum e um JSON
# de pesos produzido previamente pelo script FakeMarrakesh)
export IBM_QUANTUM_TOKEN=<seu_token>
export IBM_WEIGHTS_PATH="stage3_real_hardware/results/<arquivo_fake_marrakesh>.json"
python3 stage3_real_hardware/src/qml_ibm_real_origB_wine_fold0.pyAs Etapas 1 e 2 rodam inteiramente em simulação local. A Etapa 3 requer acesso autenticado à IBM Quantum Platform. Os JSONs e imagens gerados são mantidos fora do Git; cada etapa os grava em seu próprio diretório
results/.
| Categoria | Tecnologia |
|---|---|
| Linguagem | Python 3.10+ |
| Frameworks QML | PennyLane 0.38+, Qiskit 1.x |
| Hardware quântico | IBM Quantum Platform — IBM Marrakesh (156 qubits) |
| Simuladores | PennyLane default.mixed, FakeBrisbane, FakeMarrakesh |
| ML clássico | scikit-learn (SVM, SelectKBest, StandardScaler, MinMaxScaler) |
| Análise estatística | SciPy (Wilcoxon, Shapiro-Wilk), statsmodels (McNemar, poder de teste) |
| Visualização | Matplotlib |
| Reprodutibilidade | Sementes determinísticas via hash MD5 parametrizado |
Frederico Flauzino Wlassow — Engenharia de Software, Inatel
Orientador: Prof. MsC. Daniel Albino Mosca Rodrigues — Inatel
@thesis{wlassow2026qml,
author = {Frederico Flauzino Wlassow},
title = {Estudo Comparativo de Algoritmos Quânticos de Machine Learning
em Conjuntos de Dados Tabulares: Análise de Desempenho e
Robustez ao Ruído NISQ},
school = {Instituto Nacional de Telecomunicações (Inatel)},
year = {2026},
type = {Trabalho de Conclusão de Curso -- Engenharia de Software},
address = {Santa Rita do Sapucaí, MG, Brasil}
}This repository contains the source code, analysis and plot-generation scripts, and the consolidated results reported in this README for an undergraduate thesis in Software Engineering at the National Institute of Telecommunications — Inatel, Brazil, defended and approved in June 2026. Raw execution outputs and generated images are kept outside Git due to their volume and can be reproduced with the scripts.
The work experimentally and reproducibly investigates two quantum machine learning paradigms — Variational Quantum Circuits (VQC) and Quantum Kernel (QKernel) — on binary classification tasks over tabular datasets in the NISQ era, benchmarked against classical SVMs and validated on real IBM quantum hardware (IBM Marrakesh).
The investigation is structured across three progressive stages, each described below with its own results.
Goal: Identify which encoding and preprocessing combination maximizes VQC performance under parametrized depolarizing noise.
Experimental setup:
- 4 encoding strategies: OA (RX+RY, no re-upload), OB (RX+RZ, no re-upload), RA (RX+RY with re-upload), RB (RX+RZ with re-upload)
- 2 preprocessing pipelines: MM (MinMaxScaler) and SSKMM (StandardScaler → SelectKBest(k=nq) → MinMaxScaler)
- 5 depolarizing noise levels: p ∈ {0.000, 0.001, 0.005, 0.010, 0.050}
- 2 and 4 qubits, L=2 layers, 20 epochs, stratified 5-fold CV
- 1,200 VQC runs across 4 platforms (Mac M1, Dell, Raspberry Pi, Windows/Nitro)
Mean accuracy per configuration (collapsed over 5 folds × 5 noise levels × 3 datasets, n=75):
| Qubits | Encoding | Preprocessing | Mean Accuracy | SD |
|---|---|---|---|---|
| 2 | OA | MM | 0.866 | 0.080 |
| 2 | OA | SSKMM | 0.916 | 0.077 |
| 2 | OB | MM | 0.904 | 0.076 |
| 2 | OB | SSKMM | 0.952 | 0.053 |
| 4 | OA | MM | 0.876 | 0.086 |
| 4 | OA | SSKMM | 0.906 | 0.078 |
| 4 | OB | MM | 0.889 | 0.079 |
| 4 | OB | SSKMM | 0.913 | 0.061 |
Re-upload configurations (RA, RB) did not outperform their non-re-upload counterparts in any evaluated combination.
Key findings:
- SSKMM preprocessing was the single most impactful factor — outperformed MM in nearly all configurations (p < 0.001, paired t-test, Cohen's d up to 0.84)
- RX+RZ encoding without re-upload (OB) consistently matched or outperformed RX+RY
- Data re-uploading produced no measurable benefit on the evaluated datasets, adding circuit depth without predictive gain
- VQC accuracy remained robust to depolarizing noise across the investigated range (p ≤ 0.05); noise cost manifested in simulation time, not accuracy
Goal: Compare VQC, QKernel, and classical SVMs under calibrated real-hardware noise, evaluating both predictive performance and computational cost.
Experimental setup:
- Backend: FakeBrisbane (127 qubits, calibrated noise with real T1/T2 and gate errors)
- Algorithms: VQC origB (RX+RZ, no re-upload), VQC encB (with re-upload), QKernel (ZZFeatureMap + SVC), SVM-Linear, SVM-RBF
- Metrics: AUC, accuracy, F1-score + computational cost analysis (host energy, Cinf, Ctrain, Cvol)
- Stratified 5-fold CV, SSKMM pipeline, 4 qubits
Mean AUC per algorithm and dataset (5-fold CV, FakeBrisbane):
| Algorithm | Iris | Wine | Breast Cancer |
|---|---|---|---|
| SVM-Linear | 1.000 ± 0.000 | 0.995 ± 0.011 | 0.988 ± 0.010 |
| SVM-RBF | 1.000 ± 0.000 | 0.998 ± 0.005 | 0.985 ± 0.014 |
| VQC origB | 1.000 ± 0.000 | 0.992 ± 0.010 | 0.987 ± 0.009 |
| VQC encB | 0.997 ± 0.005 | 0.988 ± 0.010 | 0.979 ± 0.013 |
| QKernel | 0.942 ± 0.054 | 0.847 ± 0.067 | 0.929 ± 0.015 |
Key findings:
- VQC origB matched classical SVMs in AUC — no statistically significant difference after Holm-Bonferroni correction (p_adj > 0.05, paired Wilcoxon, n=15 pairs)
- QKernel showed significantly lower AUC than all other algorithms (p_adj = 0.0007), with circuit depth d=38 operating in the high-decoherence risk region (tcircuit/T2,min = 0.187)
- QKernel inference cost is O(n²) — impractical for larger datasets without approximation techniques (e.g., Nyström)
- SVM-Linear was the Pareto frontier anchor (performance × cost) across all datasets
Goal: Evaluate the transferability of a simulator-trained VQC to real quantum hardware execution, quantifying the simulation-to-hardware gap.
Experimental setup:
- Dataset: Wine, fold 0 (26 test samples)
- Training: FakeBrisbane and FakeMarrakesh (100 epochs, η=0.05, 512 shots)
- Inference: IBM Marrakesh (superconducting processor, 156 qubits) — weights transferred directly, no re-training
- 512 shots per sample, no error mitigation techniques applied
Performance per backend (Wine fold 0, n=26 samples):
| Backend | Accuracy (test) | AUC (test) | F1 (test) |
|---|---|---|---|
| FakeBrisbane | 1.000 | 1.000 | 1.000 |
| FakeMarrakesh | 1.000 | 1.000 | 1.000 |
| IBM Marrakesh (real) | 0.962 | 1.000 | 0.961 |
| Δ (real − simulator) | −0.038 | 0.000 | −0.039 |
Key findings:
- AUC preserved at 1.000 on real hardware — class separability was not compromised by physical noise
- The single misclassification concentrated on the sample with the smallest decision margin (⟨Z₀⟩ = −0.129 in simulator → −0.028 on hardware, Δ = +0.101, approximately 2.4× larger than the mean shift)
- FakeMarrakesh proved to be a more faithful proxy for IBM Marrakesh than FakeBrisbane (mean absolute shift 0.037 vs 0.044)
- Decision margin analysis identified the vulnerable sample before real hardware execution — a potential preventive robustness criterion for simulator-to-hardware pipelines
Note on statistical power: With n=26 samples and a single fold, Stage 3 results are descriptive evidence of operational viability, not statistical proof of simulator-hardware equivalence. The McNemar test requires b+c ≥ 5 discordances for valid approximation; only 1 was observed.
qml-tabular-study/
│
├── stage1_vqc_encoding/ # Stage 1: 1,200 runs, 4 encodings, 5 noise levels
│ ├── src/
│ │ ├── vqc_orig*.py # VQCs without data re-upload
│ │ ├── vqc_enc*.py # VQCs with data re-upload
│ │ └── configs/ # Experimental-machine configurations
│ ├── analysis/ # Stage statistical analyses
│ └── plots/ # Accuracy, noise robustness, and comparison figures
│
├── stage2_vqc_vs_qkernel/ # Stage 2: VQC vs QKernel vs SVM (FakeBrisbane)
│ ├── src/ # VQC, QKernel, and SVM experiments
│ ├── analysis/ # Performance, cost, noise, and scalability
│ └── plots/ # Pareto frontier, circuit depth, AUC comparison
│
├── stage3_real_hardware/ # Stage 3: Inference on IBM Marrakesh (real QPU)
│ ├── src/ # FakeBrisbane/FakeMarrakesh simulations and real execution
│ ├── analysis/ # Simulator-to-hardware gap analysis
│ └── plots/ # Decision score shift, Bloch sphere visualization
│
└── requirements.txt
| Dataset | N | Features | Classes (binarized) | Balance |
|---|---|---|---|---|
| Iris | 100 | 4 | setosa vs versicolor | 50/50 |
| Wine | 130 | 13 | class 0 vs class 1 | 59/71 |
| Breast Cancer Wisconsin | 569 | 30 | malignant vs benign | 212/357 |
Source: UCI Machine Learning Repository
# Clone the repository
git clone https://github.com/fredericowlassow/qml-tabular-study.git
cd qml-tabular-study
# Install dependencies
python3 -m pip install -r requirements.txt
# Stage 1 — example: origB VQC with SSKMM
python3 stage1_vqc_encoding/src/vqc_origB_sskmm.py
# Stage 2 — VQC vs QKernel comparison (FakeBrisbane)
python3 stage2_vqc_vs_qkernel/src/qml_nitro_origB_brisbane_v6.py
# Stage 3 — real hardware inference (requires an IBM Quantum token and a
# weights JSON previously produced by the FakeMarrakesh script)
export IBM_QUANTUM_TOKEN=<your_token>
export IBM_WEIGHTS_PATH="stage3_real_hardware/results/<fake_marrakesh_file>.json"
python3 stage3_real_hardware/src/qml_ibm_real_origB_wine_fold0.pyStages 1 and 2 run entirely in local simulation. Stage 3 requires authenticated access to IBM Quantum Platform. Generated JSON and image files are kept out of Git; each stage writes them to its own
results/directory.
| Category | Technology |
|---|---|
| Language | Python 3.10+ |
| QML Frameworks | PennyLane 0.38+, Qiskit 1.x |
| Quantum Hardware | IBM Quantum Platform — IBM Marrakesh (156 qubits) |
| Simulators | PennyLane default.mixed, FakeBrisbane, FakeMarrakesh |
| Classical ML | scikit-learn (SVM, SelectKBest, StandardScaler, MinMaxScaler) |
| Statistical Analysis | SciPy (Wilcoxon, Shapiro-Wilk), statsmodels (McNemar, power analysis) |
| Visualization | Matplotlib |
| Reproducibility | Deterministic MD5-based seeding per experiment |
Frederico Flauzino Wlassow — Software Engineering, Inatel
Advisor: Prof. MsC. Daniel Albino Mosca Rodrigues — Inatel
@thesis{wlassow2026qml,
author = {Frederico Flauzino Wlassow},
title = {Comparative Study of Quantum Machine Learning Algorithms
on Tabular Datasets: Performance and NISQ Noise Robustness Analysis},
school = {National Institute of Telecommunications (Inatel), Brazil},
year = {2026},
type = {Undergraduate Thesis -- Software Engineering},
address = {Santa Rita do Sapucaí, MG, Brazil}
}Undergraduate thesis — Software Engineering, Inatel, Brazil, 2026. Hardware experiments executed on IBM Quantum Platform (IBM Marrakesh, 156 qubits) under free-tier access (10 min/month).