Code Monkey home page Code Monkey logo

quask's Introduction

Quantum Advantage Seeker with Kernels (QuASK)

QuASK is an actively maintained library for constructing, studying, and benchmarking quantum kernel methods.

It is designed to simplify the process of choosing a quantum kernel, automate the machine learning pipeline at all its stages, and provide pedagogical guidance for early-stage researchers to utilize these tools to their full potential.

QuASK promotes the use of reusable code and is available as a library that can be seamlessly integrated into existing code bases. It is written in Python 3, can be easily installed using pip, and is accessible on PyPI.

Homepage: quask.web.cern.ch

Documentation: quask.readthedocs.io

Installation

The easiest way to use quask is by installing it in your Python3 environment (version >= 3.10) via the pip packet manager,

python3 -m pip install -U quask==2.0.0-alpha1

You also need any quantum SDK installed on your system. For example, we can install Qiskit (but we can also work with Pennylane, Braket, Qibo, and the modular nature of the software allows the creation of your own custom backends).

python3 -m pip install qiskit qiskit_ibm_runtime
python3 -m pip install qiskit_ibm_runtime --upgrade
python3 -m pip install qiskit-aer

See the Installation section of our documentation page for more information.

Examples

The fastest way to start developing using quask is via our Getting started guide.

If you are not familiar with the concept of kernel methods in classical machine learning, we have developed a series of introductory tutorials on the topic.

If you are not familiar with the concept of quantum kernels, we have developed a series of introductory tutorials on the topic, which is also used to showcase the basic functionalities of quask.

Then advanced features of quask are shown, including the use of different backends, the criteria to evaluate a quantum kernel, and the automatic optimization approach.

Finally, look here for some applications.

Source

Deployment to PyPI

The software is uploaded to PyPI.

Test

The suite of test for quask is currently under development.To run the available tests, type

pytest

You can also specify specific test scripts.

pytest tests/test_example.py

quask has been developed and tested with the following versions of the quantum frameworks:

  • PennyLane==0.32.0
  • PennyLane-Lightning==0.32.0
  • qiskit==0.44.1
  • qiskit-aer==0.12.2
  • qiskit-ibm-runtime==0.14.0

Documentation

The documentation is available at our Read the Docs domain.

Generate the documentation

The documentation has been generated with Sphinx (v7.2.6) and uses the Furo theme. To install it, run

python3 -m pip install -U sphinx
python3 -m pip install furo

To generate the documentation, run

cd docs
make clean && make html

The Sphinx configuration file (conf.py) has the following, non-standard options:

html_theme = 'furo'
html_theme_options = {
    "sidebar_hide_name": True
}
autodoc_mock_imports = ["skopt", "skopt.space", "django", "mushroom_rl", "opytimizer", "pennylane", "qiskit", "qiskit_ibm_runtime", "qiskit_aer"]

Generate the UML diagrams

Currently, the pages generated from the Python notebooks has to be compiled to RST format manually. We could use in the future the nbsphinx extension to automatize this process. This has the advantage that the documentation is always up to date, the disadvantage is that the process is much slower.

Generate the UML diagrams

The UML diagrams in the Platform overview page of the documentation are generated using pyreverse and Graphviz. They can be installed via:

sudo apt-get install graphviz
python3 -m pip install pylint

The UML diagrams are created via:

cd src/quask
pyreverse -o png -p QUASK .

Acknowledgements

The platform has been developed with the contribution of Massimiliano Incudini, Francesco Di Marcantonio, Davide Tezza, Roman Wixinger, Sofia Vallecorsa, and Michele Grossi.

If you have used quask for your project, please consider citing us.

@article{dimarcantonio2023quask,
    title={Quantum Advantage Seeker with Kernels (QuASK): a software framework to accelerate research in quantum machine learning},
    author={Di Marcantonio, Francesco and Incudini, Massimiliano and Tezza, Davide and Grossi, Michele},
    journal={Quantum Machine Intelligence},
    volume={5},
    number={1},
    pages={20},
    year={2023},
    publisher={Springer}
}

quask's People

Contributors

fradm98 avatar grossim avatar incud avatar romanwixinger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

quask's Issues

Equation of Geometric Difference

Hi,

I would like to clarify the following code that was used to implement geometric difference from the paper: "The power of data in quantum machine learning".

def calculate_geometric_difference(k_1, k_2, normalization_lambda=0.001):
"""
Calculate the geometric difference g(K_1 || K_2), which is equation F9 in
"The power of data in quantum machine learning" (https://arxiv.org/abs/2011.01938)
and characterize the separation between classical and quantum kernels.
Args:
k_1: Quantum kernel Gram matrix
k_2: Classical kernel Gram matrix
normalization_lambda: normalization factor, must be close to zero
Returns:
geometric difference between the two kernel functions (float).
"""

In the paper, geometric difference between classical and quantum (gcq ) is defined with k1 = classical kernel and k2 = quantum kernel. However, in your code implementation, k1 is quantum and k2 is classical. As the equation is asymmetric to the order of the matrices k1 and k2, could there be an error in the code implementation?

Thanks for taking the time to read this!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.