{"id":13536202,"url":"https://github.com/qiskit-community/qiskit-machine-learning","last_synced_at":"2025-12-24T11:43:08.659Z","repository":{"id":36952821,"uuid":"342885422","full_name":"qiskit-community/qiskit-machine-learning","owner":"qiskit-community","description":"Quantum Machine Learning","archived":false,"fork":false,"pushed_at":"2025-05-14T08:43:30.000Z","size":67839,"stargazers_count":760,"open_issues_count":29,"forks_count":348,"subscribers_count":20,"default_branch":"main","last_synced_at":"2025-05-14T09:47:08.199Z","etag":null,"topics":["qiskit"],"latest_commit_sha":null,"homepage":"https://qiskit-community.github.io/qiskit-machine-learning/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qiskit-community.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-02-27T15:10:30.000Z","updated_at":"2025-05-14T08:43:34.000Z","dependencies_parsed_at":"2023-10-05T14:17:42.202Z","dependency_job_id":"6591ed28-613d-4e72-9b69-8d6d9a7b7440","html_url":"https://github.com/qiskit-community/qiskit-machine-learning","commit_stats":null,"previous_names":["qiskit-community/qiskit-machine-learning","qiskit/qiskit-machine-learning"],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qiskit-community%2Fqiskit-machine-learning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qiskit-community%2Fqiskit-machine-learning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qiskit-community%2Fqiskit-machine-learning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qiskit-community%2Fqiskit-machine-learning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qiskit-community","download_url":"https://codeload.github.com/qiskit-community/qiskit-machine-learning/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254138963,"owners_count":22021088,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["qiskit"],"created_at":"2024-08-01T09:00:35.805Z","updated_at":"2025-12-24T11:43:08.650Z","avatar_url":"https://github.com/qiskit-community.png","language":"Python","funding_links":[],"categories":["Quantum Software Packages","Community","Python","Frameworks \u0026 Libraries"],"sub_categories":["Quantum Machine Learning \u0026 Hybrid Frameworks"],"readme":"# Qiskit Machine Learning\n\n[![License](https://img.shields.io/github/license/qiskit-community/qiskit-machine-learning.svg?)](https://opensource.org/licenses/Apache-2.0) \u003c!--- long-description-skip-begin --\u003e\n[![Current Release](https://img.shields.io/github/release/qiskit-community/qiskit-machine-learning.svg?logo=Qiskit)](https://github.com/qiskit-community/qiskit-machine-learning/releases)\n[![Build Status](https://github.com/qiskit-community/qiskit-machine-learning/actions/workflows/main.yml/badge.svg)](https://github.com/qiskit-community/qiskit-machine-learning/actions?query=workflow%3A\"Machine%20Learning%20Unit%20Tests\"+branch%3Amain+event%3Apush)\n[![Coverage Status](https://coveralls.io/repos/github/qiskit-community/qiskit-machine-learning/badge.svg?branch=main)](https://coveralls.io/github/qiskit-community/qiskit-machine-learning?branch=main)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/qiskit-machine-learning)\n[![Monthly downloads](https://img.shields.io/pypi/dm/qiskit-machine-learning.svg)](https://pypi.org/project/qiskit-machine-learning/)\n[![Total downloads](https://static.pepy.tech/badge/qiskit-machine-learning)](https://pepy.tech/project/qiskit-machine-learning)\n[![Slack Organisation](https://img.shields.io/badge/slack-chat-blueviolet.svg?label=Qiskit%20Slack\u0026logo=slack)](https://slack.qiskit.org)\n[![arXiv](https://img.shields.io/badge/arXiv-2505.17756-b31b1b.svg)](https://arxiv.org/abs/2505.17756)\n[![arXiv](https://img.shields.io/badge/GitHub%20Pages-Documentation-blue.svg)](https://qiskit-community.github.io/qiskit-machine-learning/)\n\n\u003c!--- long-description-skip-end --\u003e\n\n## What is Qiskit Machine Learning?\n\nQiskit Machine Learning introduces fundamental computational building blocks, such as Quantum \nKernels and Quantum Neural Networks, used in various applications including classification \nand regression.\n\nThis library is part of the Qiskit Community ecosystem, a collection of high-level libraries that are based\non the Qiskit software development kit. As of version `0.7`, Qiskit Machine Learning is co-maintained\nby IBM and the [Hartree Centre](https://www.hartree.stfc.ac.uk/), part of the UK Science and \nTechnologies Facilities Council (STFC).\n\n\u003e [!NOTE]\n\u003e A description of the library structure, features, and domain-specific applications, can be found \n\u003e in a dedicated [![arXiv](https://img.shields.io/badge/arXiv-2505.17756-b31b1b.svg)](https://arxiv.org/abs/2505.17756)\n\u003e paper. For more details on usage and the API, refer to the [![arXiv](https://img.shields.io/badge/Documentation-blue.svg)](https://qiskit-community.github.io/qiskit-machine-learning/).\n\nThe Qiskit Machine Learning framework aims to be:\n\n* **User-friendly**, allowing users to quickly and easily prototype quantum machine learning models without \n    the need of extensive quantum computing knowledge.\n* **Flexible**, providing tools and functionalities to conduct proofs-of-concept and innovative research \n    in quantum machine learning for both beginners and experts.\n* **Extensible**, facilitating the integration of new cutting-edge features leveraging Qiskit's \n    architectures, patterns and related services.\n\n\n## What are the main features of Qiskit Machine Learning?\n\n### Kernel-based methods\n\nThe [`FidelityQuantumKernel`](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.kernels.QuantumKernel.html#qiskit_machine_learning.kernels.FidelityQuantumKernel) \nclass uses the [`Fidelity`](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.state_fidelities.BaseStateFidelity.html) \nalgorithm. It computes kernel matrices for datasets and can be combined with a Quantum Support Vector Classifier ([`QSVC`](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.algorithms.QSVC.html#qiskit_machine_learning.algorithms.QSVC)) \nor a Quantum Support Vector Regressor ([`QSVR`](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.algorithms.QSVR.html#qiskit_machine_learning.algorithms.QSVR)) \nto solve classification or regression problems respectively. It is also compatible with classical kernel-based machine learning algorithms.\n\n\n### Quantum Neural Networks (QNNs)\n\nQiskit Machine Learning defines a generic interface for neural networks, implemented by two core (derived) primitives:\n\n- **[`EstimatorQNN`](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.neural_networks.EstimatorQNN.html):** Leverages the [`Estimator`](https://quantum.cloud.ibm.com/docs/api/qiskit/1.4/qiskit.primitives.BaseEstimator) primitive, combining parametrized quantum circuits with quantum mechanical observables. The output is the expected value of the observable.\n  \n- **[`SamplerQNN`](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.neural_networks.SamplerQNN.html):** Leverages the [`Sampler`](https://quantum.cloud.ibm.com/docs/api/qiskit/1.4/qiskit.primitives.BaseSampler) primitive, translating bit-string counts into the desired outputs.\n\nTo train and use neural networks, Qiskit Machine Learning provides learning algorithms such as the [`NeuralNetworkClassifier`](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.algorithms.NeuralNetworkClassifier.html#qiskit_machine_learning.algorithms.NeuralNetworkClassifier) \nand [`NeuralNetworkRegressor`](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.algorithms.NeuralNetworkRegressor.html#qiskit_machine_learning.algorithms.NeuralNetworkRegressor). \nFinally, built on these, the Variational Quantum Classifier ([`VQC`](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.algorithms.VQC.html#qiskit_machine_learning.algorithms.VQC))\nand the Variational Quantum Regressor ([`VQR`](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.algorithms.VQR.html#qiskit_machine_learning.algorithms.VQR))\ntake a _feature map_ and an _ansatz_ to construct the underlying QNN automatically using high-level syntax.\n\n### Integration with PyTorch\n\nThe [`TorchConnector`](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.connectors.TorchConnector.html#qiskit_machine_learning.connectors.TorchConnector) \nintegrates QNNs with [PyTorch](https://pytorch.org). \nThanks to the gradient algorithms in Qiskit Machine Learning, this includes automatic differentiation. \nThe overall gradients computed by PyTorch during the backpropagation take into account quantum neural \nnetworks, too. The flexible design also allows the building of connectors to other packages or accelerated\nlibraries.\n\n## Installation and documentation\n\nWe encourage installing Qiskit Machine Learning via the `pip` tool, a `Python` package manager.\n\n```bash\npip install qiskit-machine-learning\n```\n\n`pip` will install all dependencies automatically, so that you will always have the most recent\nstable version.\n\nIf you want to work instead on the very latest _work-in-progress_ versions of Qiskit Machine Learning, \neither to try features ahead of\ntheir official release or if you want to contribute to the library, then you can install from source.\nFor more details on how to do so and much more, follow the instructions in the\n [documentation](https://qiskit-community.github.io/qiskit-machine-learning/getting_started.html#installation).\n\n### Optional Installs\n\n* **PyTorch** may be installed either using command `pip install 'qiskit-machine-learning[torch]'` to install the\n  package or refer to PyTorch [getting started](https://pytorch.org/get-started/locally/) guide. When PyTorch\n  is installed, the `TorchConnector` facilitates the combination of hybrid quantum-classical neural networks.\n\n* **Sparse** may be installed using command `pip install 'qiskit-machine-learning[sparse]'` to install the\n  package. [Sparse](https://sparse.pydata.org/en/latest/) is built on top of NumPy and `scipy.sparse`, and enables\n  efficient operations of sparse arrays and tensors. Refer to the Sparse [installation guide](https://sparse.pydata.org/en/latest/install/)\n  for further details.\n\n* **NLopt** is required for the global optimizers. [`NLopt`](https://nlopt.readthedocs.io/en/latest/) \n  can be installed manually with `pip install nlopt` on Windows and Linux platforms, or with `brew \n  install nlopt` on MacOS using the Homebrew package manager. For more information, \n  refer to the [installation guide](https://nlopt.readthedocs.io/en/latest/NLopt_Installation/).\n\n----------------------------------------------------------------------------------------------------\n\n### Creating your first Qiskit Machine Learning program\n\nNow that Qiskit Machine Learning is installed, it's time to begin working with the machine \nlearning modules. Let's try an experiment using VQC (Variational Quantum Classifier) algorithm to\ntrain and test samples from a data set to see how accurately the test set can be classified.\n\n```python\nfrom qiskit.circuit.library import n_local, zz_feature_map\nfrom qiskit_machine_learning.optimizers import COBYLA\nfrom qiskit_machine_learning.utils import algorithm_globals\n\nfrom qiskit_machine_learning.algorithms import VQC\nfrom qiskit_machine_learning.datasets import ad_hoc_data\n\nseed = 1376\nalgorithm_globals.random_seed = seed\n\n# Use ad hoc data set for training and test data\nfeature_dim = 2  # dimension of each data point\ntraining_size = 20\ntest_size = 10\n\n# training features, training labels, test features, test labels as np.ndarray,\n# one hot encoding for labels\ntraining_features, training_labels, test_features, test_labels = ad_hoc_data(\n    training_size=training_size, test_size=test_size, n=feature_dim, gap=0.3\n)\n\nfeature_map = zz_feature_map(feature_dimension=feature_dim, reps=2, entanglement=\"linear\")\nansatz = n_local(feature_map.num_qubits, [\"ry\", \"rz\"], \"cz\", reps=3)\nvqc = VQC(\n    feature_map=feature_map,\n    ansatz=ansatz,\n    optimizer=COBYLA(maxiter=100),\n)\nvqc.fit(training_features, training_labels)\n\nscore = vqc.score(test_features, test_labels)\nprint(f\"Testing accuracy: {score:0.2f}\")\n```\n\n### More examples\n\nLearning materials can be found in the\n[Tutorials](https://qiskit-community.github.io/qiskit-machine-learning/tutorials/index.html) section\nof the documentation. These notebooks will walk you step by step through different tasks and are designed to be hackable,\nmaking them a great place to start.\n\nAnother good place to learn the fundamentals of quantum machine learning is the\n[Quantum Machine Learning](https://github.com/Qiskit/textbook/tree/main/notebooks/quantum-machine-learning#) notebooks from the original Qiskit Textbook (now archived). \nThe notebooks are convenient for beginners who are eager to learn \nquantum machine learning from scratch, as well as understand the background and theory behind algorithms in\nQiskit Machine Learning. The notebooks cover a variety of topics to build an understanding of parameterized\ncircuits, data encoding, variational algorithms and more, with the ultimate goal of building and training quantum ML models \nfor supervised and unsupervised learning. \nThe Textbook notebooks are complementary to the tutorials of this library. These tutorials focus emphasize the algorithms, \nwhile the Textbook notebooks explain in more detail the underlying fundamental quantum information principles\nof quantum machine learning.\n\n----------------------------------------------------------------------------------------------------\n\n## How can I contribute?\n\nIf you'd like to contribute to Qiskit, please take a look at our\n[contribution guidelines](https://github.com/qiskit-community/qiskit-machine-learning/blob/main/CONTRIBUTING.md).\nThis project adheres to the Qiskit [code of conduct](https://github.com/qiskit-community/qiskit-machine-learning/blob/main/CODE_OF_CONDUCT.md).\nBy participating, you are expected to uphold this code.\n\nWe use [GitHub issues](https://github.com/qiskit-community/qiskit-machine-learning/issues) for tracking requests and bugs. Please\n[join the Qiskit Slack community](https://qisk.it/join-slack)\nand use the [`#qiskit-machine-learning`](https://qiskit.enterprise.slack.com/archives/C07JE3V55C1) \nchannel for discussions and short questions.\nFor questions that are more suited for a forum, you can use the **Qiskit** tag in [Stack Overflow](https://stackoverflow.com/questions/tagged/qiskit).\n\n## How can I cite Qiskit Machine Learning?\n\nIf you use Qiskit Machine Learning in your work, please cite the \"overview\" [ArXiv paper](https://arxiv.org/abs/2505.17756) to \nsupport the continued development and visibility of the library. The BibTeX citation handle can be found in the \n[`CITATION.bib`](./CITATION.bib) file.\n\n## Humans behind Qiskit Machine Learning\n\nQiskit Machine Learning was inspired, authored and brought about by the collective work of a \nteam of researchers  and software engineers. This library continues to grow with the help and \nwork of \n[many people](https://github.com/qiskit-community/qiskit-machine-learning/graphs/contributors), \nwho contribute to the project at different levels.\n\n## License\n\nThis project uses the [Apache License 2.0](https://github.com/qiskit-community/qiskit-machine-learning/blob/main/LICENSE.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqiskit-community%2Fqiskit-machine-learning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqiskit-community%2Fqiskit-machine-learning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqiskit-community%2Fqiskit-machine-learning/lists"}