Skip to content

MuratKarslioglu/quantum-boosting-hyperopt

Quantum Hyperparameter Optimization for Boosting Algorithms

A comparative study of classical boosting algorithms with and without
quantum-circuit-based hyperparameter optimization via PennyLane variational circuits


Table of Contents


Overview

This project compares classical boosting algorithms (XGBoost, AdaBoost, Gradient Boost, CatBoost, LightGBM, HistGradientBoosting) in two configurations:

  1. Classical baseline — standard model with GridSearchCV or default hyperparameters
  2. Quantum hyperparameter optimization — hyperparameters are proposed by a variational quantum circuit implemented in PennyLane, then used to configure the same classical model

The quantum circuit acts as a hyperparameter proposal mechanism: it takes encoded input, applies parameterized rotation gates and entangling layers, and maps measurement outcomes (Pauli-Z expectation values) to valid hyperparameter ranges via a scaling function.

This is a learning and exploration project, not a production system. The goal is to build hands-on experience with quantum machine learning by applying variational circuits to a familiar ML context — boosting algorithm hyperparameter search.


Motivation

Hyperparameter optimization is one of the most resource-intensive parts of machine learning workflows. Classical approaches (grid search, random search, Bayesian optimization) can be slow for large search spaces. Variational quantum circuits are being explored as potential alternatives for optimization tasks due to their ability to represent complex probability distributions in compact parameterized form.

This project investigates a simple question in a controlled setting:

Can a variational quantum circuit propose competitive hyperparameters for classical boosting algorithms, compared to classical grid search?

The scope is intentionally narrow — this is a first exploration, not a definitive benchmark.


Algorithms Covered

Algorithm Classical Notebook Quantum Notebook
XGBoost xgboost_classic.ipynb xgboost_quantum_hyperopt.ipynb
XGBoost (refined) xgboost_quantum_final.ipynb
AdaBoost adaboost_classic.ipynb adaboost_quantum_hyperopt.ipynb
Gradient Boost gradient_boost_classic.ipynb gradient_boost_quantum_hyperopt.ipynb
CatBoost catboost_classic.ipynb catboost_quantum_hyperopt.ipynb
LightGBM lightgbm_classic.ipynb lightgbm_quantum_hyperopt.ipynb
HistGradientBoosting histgradient_classic.ipynb histgradient_quantum_hyperopt.ipynb

Quantum Hyperparameter Optimization Approach

Circuit Design

Each quantum notebook uses a variational quantum circuit with the following structure:

For each qubit i:
    RY(params[i])           ← angle embedding of input
    RZ(params[i] * 0.5)     ← additional phase rotation

Entanglement:
    CNOT(0→1), CNOT(1→2), ..., CNOT(n-1→n)   ← linear chain

Measurement:
    <Z_i> for all i  →  expectation values in [-1, 1]

Hyperparameter Mapping

Pauli-Z expectation values are mapped to hyperparameter ranges using linear scaling:

n_estimators  = int(150 + 250 * abs(outputs[0]))   # [150, 400]
learning_rate = 0.01 + 0.2 * abs(outputs[1])        # [0.01, 0.21]
max_depth     = int(3 + 8 * abs(outputs[2]))         # [3, 11]
subsample     = 0.4 + 0.6 * abs(outputs[3])          # [0.4, 1.0]
colsample     = 0.4 + 0.6 * abs(outputs[4])          # [0.4, 1.0]
reg_lambda    = 0.1 + 7 * abs(outputs[2])            # [0.1, 7.1]
reg_alpha     = 0.1 + 7 * abs(outputs[1])            # [0.1, 7.1]

Optimization Loop

The quantum circuit parameters are optimized using scipy.optimize.minimize with the Powell method. The objective function trains the boosting model with circuit-proposed hyperparameters and returns the validation loss.

Qubit Scaling Experiment

The results/ folder contains experiments run with 0 to 40 qubits for both XGBoost and Gradient Boost. Each .txt file contains the full code used for that qubit configuration, allowing reproduction and comparison across circuit sizes.


Repository Structure

quantum-boosting-hyperopt/
│
├── notebooks/                          # Jupyter notebooks — one folder per algorithm
│   ├── xgboost/
│   │   ├── xgboost_classic.ipynb       # XGBoost with GridSearchCV
│   │   ├── xgboost_quantum_hyperopt.ipynb    # Quantum hyperopt v1
│   │   └── xgboost_quantum_final.ipynb       # Quantum hyperopt refined
│   ├── adaboost/
│   │   ├── adaboost_classic.ipynb
│   │   └── adaboost_quantum_hyperopt.ipynb
│   ├── gradient_boost/
│   │   ├── gradient_boost_classic.ipynb
│   │   └── gradient_boost_quantum_hyperopt.ipynb
│   ├── catboost/
│   │   ├── catboost_classic.ipynb
│   │   └── catboost_quantum_hyperopt.ipynb
│   ├── lightgbm/
│   │   ├── lightgbm_classic.ipynb
│   │   └── lightgbm_quantum_hyperopt.ipynb
│   └── histgradient_boost/
│       ├── histgradient_classic.ipynb
│       └── histgradient_quantum_hyperopt.ipynb
│
├── results/                            # Qubit scaling experiment results (0–40 qubits)
│   ├── xgboost/                        # xgboost_0qubit.txt ... xgboost_40qubit.txt
│   └── gradient_boost/                 # gradient_boost_0qubit.txt ... _40qubit.txt
│
├── data/                               # Input datasets
│   ├── dataset_quantum_hyperopt.csv    # Primary dataset used in quantum experiments
│   └── dataset_boosting_v1.csv         # Original dataset from first experiments
│
├── docs/                               # Extended documentation
│   ├── methodology.md
│   ├── quantum_circuit_design.md
│   ├── limitations.md
│   └── future_work.md
│
├── requirements.txt
├── LICENSE
├── CITATION.cff
├── CONTRIBUTING.md
├── CHANGELOG.md
└── README.md

Installation

git clone https://github.com/MuratKarslioglu/quantum-boosting-hyperopt.git
cd quantum-boosting-hyperopt

python -m venv venv
venv\Scripts\activate      # Windows
# source venv/bin/activate  # macOS/Linux

pip install -r requirements.txt

Core dependencies:

Package Purpose
pennylane Quantum circuit simulation
torch GPU tensor support for quantum simulation
xgboost XGBoost algorithm
lightgbm LightGBM algorithm
catboost CatBoost algorithm
scikit-learn AdaBoost, GradientBoosting, HistGradientBoosting, metrics
scipy Powell optimizer for quantum circuit parameters
pandas, numpy Data handling

Usage

Each notebook is self-contained. Open the relevant notebook in Jupyter and run all cells.

Before running, update the dataset path at the top of each notebook:

file_path = "../../data/dataset_quantum_hyperopt.csv"

To reproduce qubit scaling experiments, refer to the .txt files in results/xgboost/ or results/gradient_boost/. Each file is a complete, runnable Python script for that qubit count.


Input Data

dataset_quantum_hyperopt.csv

The primary dataset used in all quantum hyperparameter optimization experiments.

Column Description
Feature1, Feature2, Feature3 Input features (numerical)
Target Target variable (regression)

dataset_boosting_v1.csv

The original dataset used in early exploratory experiments (first paper version).


Results

Qubit scaling experiment outputs are stored in results/xgboost/ and results/gradient_boost/ for 0 to 40 qubits. Each file contains the full code and configuration used, enabling full reproducibility.

Metrics reported per experiment:

  • MSE (Mean Squared Error) on test set
  • R² Score on test set
  • Optimized hyperparameter values proposed by the quantum circuit

Limitations and Honest Notes

This is a learning and exploration project. The following limitations apply:

  • Quantum circuits run on classical simulator (default.qubit) — no real quantum hardware
  • The quantum circuit proposes hyperparameters through a fixed scaling function, not a learned search distribution
  • No rigorous statistical comparison (e.g., multiple runs, significance tests) is included
  • Some notebooks are minimal or incomplete — this reflects the exploratory nature of the work
  • The approach is closer to "quantum-assisted search" than "quantum machine learning" in the strict sense
  • Results may vary significantly between runs due to random initialization of circuit parameters

This project is shared as part of a personal learning journey in quantum computing, not as a definitive benchmark.


Future Work

  • Add statistical comparison: multiple random seeds, mean ± std for all metrics
  • Implement gradient-based quantum optimization (parameter-shift rule) instead of Powell
  • Extend to classification tasks and additional datasets
  • Add a structured results summary table across all algorithms and qubit counts
  • Explore noise-aware training with PennyLane noise models
  • Compare against Bayesian optimization as a stronger classical baseline

How to Cite

@software{karslioglu2026quantum_boosting,
  author    = {Karslioglu, Murat},
  title     = {Quantum Hyperparameter Optimization for Boosting Algorithms},
  year      = {2026},
  publisher = {GitHub},
  url       = {https://github.com/MuratKarslioglu/quantum-boosting-hyperopt}
}

License

MIT License — see LICENSE for details.



Boosting Algoritmaları için Kuantum Hiperparametre Optimizasyonu

PennyLane varyasyonel devreleri aracılığıyla kuantum devre tabanlı hiperparametre optimizasyonu ile
klasik boosting algoritmalarının karşılaştırmalı çalışması


İçindekiler


Genel Bakış

Bu proje, klasik boosting algoritmalarını (XGBoost, AdaBoost, Gradient Boost, CatBoost, LightGBM, HistGradientBoosting) iki konfigürasyonda karşılaştırır:

  1. Klasik referans noktası — GridSearchCV veya varsayılan hiperparametrelerle standart model
  2. Kuantum hiperparametre optimizasyonu — hiperparametreler PennyLane ile uygulanan varyasyonel bir kuantum devre tarafından önerilir, ardından aynı klasik modeli yapılandırmak için kullanılır

Kuantum devresi hiperparametre öneri mekanizması olarak işlev görür: kodlanmış girdiyi alır, parametreleştirilmiş rotasyon kapıları ve dolaşma katmanları uygular ve ölçüm sonuçlarını (Pauli-Z beklenti değerleri) bir ölçekleme fonksiyonu aracılığıyla geçerli hiperparametre aralıklarıyla eşleştirir.

Bu bir öğrenme ve keşif projesidir, üretim sistemi değildir. Amaç, varyasyonel devreleri tanıdık bir ML bağlamına uygulayarak — boosting algoritması hiperparametre araması — kuantum makine öğrenmesiyle uygulamalı deneyim kazanmaktır.


Motivasyon

Hiperparametre optimizasyonu, makine öğrenmesi iş akışlarının en kaynak yoğun bölümlerinden biridir. Klasik yaklaşımlar (ızgara araması, rastgele arama, Bayesian optimizasyon) büyük arama uzayları için yavaş olabilir. Varyasyonel kuantum devreler, kompakt parametreleştirilmiş formda karmaşık olasılık dağılımlarını temsil edebilme yetenekleri nedeniyle optimizasyon görevleri için potansiyel alternatifler olarak araştırılmaktadır.

Bu proje, kontrollü bir ortamda basit bir soruyu araştırır:

Varyasyonel bir kuantum devresi, klasik ızgara aramasına kıyasla klasik boosting algoritmaları için rekabetçi hiperparametreler önerebilir mi?


Kapsanan Algoritmalar

Algoritma Klasik Notebook Kuantum Notebook
XGBoost xgboost_classic.ipynb xgboost_quantum_hyperopt.ipynb
XGBoost (rafine) xgboost_quantum_final.ipynb
AdaBoost adaboost_classic.ipynb adaboost_quantum_hyperopt.ipynb
Gradient Boost gradient_boost_classic.ipynb gradient_boost_quantum_hyperopt.ipynb
CatBoost catboost_classic.ipynb catboost_quantum_hyperopt.ipynb
LightGBM lightgbm_classic.ipynb lightgbm_quantum_hyperopt.ipynb
HistGradientBoosting histgradient_classic.ipynb histgradient_quantum_hyperopt.ipynb

Kuantum Hiperparametre Optimizasyon Yaklaşımı

Devre Tasarımı

Her kubit i için:
    RY(params[i])           ← girdi açı gömme
    RZ(params[i] * 0.5)     ← ek faz rotasyonu

Dolaşma:
    CNOT(0→1), CNOT(1→2), ..., CNOT(n-1→n)   ← doğrusal zincir

Ölçüm:
    <Z_i> tüm i için  →  [-1, 1] aralığında beklenti değerleri

Hiperparametre Eşleme

Pauli-Z beklenti değerleri, doğrusal ölçekleme kullanılarak hiperparametre aralıklarına eşlenir:

n_estimators  = int(150 + 250 * abs(outputs[0]))   # [150, 400]
learning_rate = 0.01 + 0.2 * abs(outputs[1])        # [0.01, 0.21]
max_depth     = int(3 + 8 * abs(outputs[2]))         # [3, 11]
subsample     = 0.4 + 0.6 * abs(outputs[3])          # [0.4, 1.0]

Kubit Ölçekleme Deneyi

results/ klasörü, hem XGBoost hem Gradient Boost için 0'dan 40'a kadar kubit ile çalıştırılan deneyleri içerir. Her .txt dosyası, o kubit konfigürasyonu için kullanılan kodun tamamını içerir.


Depo Yapısı

quantum-boosting-hyperopt/
│
├── notebooks/                          # Jupyter notebookları — algoritma başına bir klasör
│   ├── xgboost/
│   ├── adaboost/
│   ├── gradient_boost/
│   ├── catboost/
│   ├── lightgbm/
│   └── histgradient_boost/
│
├── results/                            # Kubit ölçekleme deney sonuçları (0–40 kubit)
│   ├── xgboost/
│   └── gradient_boost/
│
├── data/                               # Girdi veri setleri
├── docs/                               # Genişletilmiş belgeler
├── requirements.txt
├── LICENSE
└── README.md

Kurulum

git clone https://github.com/MuratKarslioglu/quantum-boosting-hyperopt.git
cd quantum-boosting-hyperopt
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt

Kullanım

Her notebook bağımsızdır. İlgili notebook'u Jupyter'da açın ve tüm hücreleri çalıştırın.

Çalıştırmadan önce her notebook'un başındaki veri seti yolunu güncelleyin:

file_path = "../../data/dataset_quantum_hyperopt.csv"

Girdi Verisi

dataset_quantum_hyperopt.csv — Tüm kuantum hiperparametre optimizasyon deneylerinde kullanılan birincil veri seti. Sütunlar: Feature1, Feature2, Feature3, Target.

dataset_boosting_v1.csv — İlk makale versiyonundaki erken keşif deneylerinde kullanılan orijinal veri seti.


Sınırlılıklar ve Dürüst Notlar

Bu bir öğrenme ve keşif projesidir. Aşağıdaki sınırlılıklar geçerlidir:

  • Kuantum devreler klasik simülatörde (default.qubit) çalışır — gerçek kuantum donanımı yoktur
  • Kuantum devresi, öğrenilmiş bir arama dağılımı değil, sabit bir ölçekleme fonksiyonu aracılığıyla hiperparametreler önerir
  • Titiz istatistiksel karşılaştırma (birden fazla çalıştırma, anlamlılık testleri) dahil değildir
  • Bazı notebook'lar minimal veya tamamlanmamıştır — bu çalışmanın keşifsel niteliğini yansıtır
  • Proje, kesin bir kıyaslama değil, kuantum bilişimde kişisel bir öğrenme yolculuğunun parçası olarak paylaşılmaktadır

Atıf

@software{karslioglu2026quantum_boosting,
  author    = {Karslioglu, Murat},
  title     = {Quantum Hyperparameter Optimization for Boosting Algorithms},
  year      = {2026},
  publisher = {GitHub},
  url       = {https://github.com/MuratKarslioglu/quantum-boosting-hyperopt}
}

Lisans

MIT Lisansı — ayrıntılar için LICENSE dosyasına bakınız.

About

Quantum circuit-based hyperparameter optimization for boosting algorithms (XGBoost, AdaBoost, GradientBoost, CatBoost, LightGBM) using PennyLane variational circuits — classical vs quantum comparison

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors