Skip to content

ironfrown/qml_abc_lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quantum Machine Learning A-B-C in Qiskit

  • Author: Jacob Cybulski (LinkedIn), Enquanted

  • Associated with: QPoland

  • Aims: To support a workshop session exploring the creation and use of quantum machine learning models in Qiskit.

  • Prerequisites: This GitHub assumes the prior knowledge of quantum computing and machines learning, as well as some experience with Python programming and Qiskit.

  • Description: This QML ABC lab explores the process of developing a simple quantum model in Qiskit.
    The lab includes three practical sessions that cover the QML concepts, models, and techniques.
    The first introductory lab will be demonstrated by the presenter.
    The second lab is designed to be completed by the participants and its tasks discussed on Discord.
    The final lab is a challenge, to be undertaken by the participants themselves.

  • Creation Date:
    October 1, 2022: Initial development
    August 24, 2025: Presented to QBronze-167 Workshop

  • How to cite this work:
    If you are a researcher and wanted to use these resources, please cite my work as follows.

    The presentation (slides and video when available):
    Jacob L. Cybulski, "Quantum Algorithms and Data Encoding for QML with Qiskit",
    QBronze-167 Workshop by QIndia / QWorld, August 9-10 and 23-24, 2025,
    https://jacobcybulski.com/seminars/slides/2025_QIndia_QML_ABC_v1_4.pdf.

    This GitHub:
    Jacob L. Cybulski (ironfrown), "Quantum Machine Learning A-B-C in Qiskit",
    GitHub, 2025, https://github.com/ironfrown/qml_abc_lab/, Accessed Day-Month-Year.

Folders

This site is structured as follows:

  • dev: developement versions of the three labs notebooks
  • runs: answers to all tasks set in the labs, except for:
    • Lab 2 (Homework): answers to tasks G and H have not been provided
    • Lab 3 (Challenge): answers to tasks B and C have not been provided
  • examples: additional relevant QML examples
  • utils: utilities for charting, filing and segmenting data, a few models, etc.
    In my demo, I will use mainly some clever chart plotting functions.
  • slides: presentation slides in PDF (as they become available)
  • legacy: previous versions of files (in case you really really wanted them)

Important notebooks

You can play with these notebooks implementing QML curve-fitting models in Qiskit, enjoy!
Their simplicity is misleading as the tasks set by these labs will make you sweat.
Note however that these notebooks may be updated at any time!

Notebook Dataset Model Description
qml_abc_01_sin sin_n100 qnn_model_1 A simple QML model trained on very simple "sine" function.
qml_abc_02_sinful sinful_n100 qnn_model_2 An evil twist in a trig "sinful" data makes the previous model unworkable.
On QML portals typical advice is make the model more "expressive".
He he he, they never give their code solution to help you out!
sinless_n100 qnn_model_2 Once we fix the "sinful" model, this new "sinless" dataset will wreck it.
qml_abc_03_mglass mackie_glass qnn_model_3 The challenge exercise is to create a Qiskit model for Mackie-Glass data.

Requirements

This repository requires Qiskit v1.4.4 and Qiskit ML 0.8.3.
at the development time Qiskit ML was incompatible with Qiskit v2.0+.

  • Create a Qiskit conda environment and activate it
    conda create -n qiskit-qml python=3.11
    conda activate qiskit-qml
  • install the Qiskit package, which includes ML:
    pip install qiskit[visualization]==1.4.4
    pip install qiskit-ibm-runtime
    pip install qiskit-aer or pip install qiskit-aer-gpu
    pip install qiskit-machine-learning ==0.8.3
  • The following packages would have been installed as well:
    numpy matplotlib pandas pillow rustworkx scipy scikit-learn seaborn
  • Additional packages often used:
    pip install jupyter jupyterlab
    conda install freetype
  • Run jupyter or jupyter lab

All code was tested on Ubuntu 22.04-24.04.

License

This project is licensed under the GNU General Public License v3.
The GPL v3 license requires attribution for modifications and derivatives,
ensuring that users know which versions are changed and to protect the reputations of original authors.

About

The aim of this lab is to explore the process of developing a simple curve-fitting quantum model in Qiskit.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published