-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: a854d428f49551f4fff5b7464ff1c0e2 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.. _qiskit-machine-learning-algorithms: | ||
|
||
.. automodule:: qiskit_machine_learning.algorithms | ||
:no-members: | ||
:no-inherited-members: | ||
:no-special-members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.. _qiskit-machine-learning-circuit-library: | ||
|
||
.. automodule:: qiskit_machine_learning.circuit.library | ||
:no-members: | ||
:no-inherited-members: | ||
:no-special-members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.. _qiskit-machine-learning-connectors: | ||
|
||
.. automodule:: qiskit_machine_learning.connectors | ||
:no-members: | ||
:no-inherited-members: | ||
:no-special-members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.. _qiskit-machine-learning-datasets: | ||
|
||
.. automodule:: qiskit_machine_learning.datasets | ||
:no-members: | ||
:no-inherited-members: | ||
:no-special-members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.. _qiskit-machine-learning-kernels-algorithms: | ||
|
||
.. automodule:: qiskit_machine_learning.kernels.algorithms | ||
:no-members: | ||
:no-inherited-members: | ||
:no-special-members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.. _qiskit-machine-learning-kernels: | ||
|
||
.. automodule:: qiskit_machine_learning.kernels | ||
:no-members: | ||
:no-inherited-members: | ||
:no-special-members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.. _qiskit-machine-learning-neural_networks: | ||
|
||
.. automodule:: qiskit_machine_learning.neural_networks | ||
:no-members: | ||
:no-inherited-members: | ||
:no-special-members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
===================================== | ||
Qiskit Machine Learning API Reference | ||
===================================== | ||
|
||
.. _qiskit-machine-learning: | ||
|
||
.. automodule:: qiskit_machine_learning | ||
:no-members: | ||
:no-inherited-members: | ||
:no-special-members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.. _qiskit-machine-learning-utils-loss_functions: | ||
|
||
.. automodule:: qiskit_machine_learning.utils.loss_functions | ||
:no-members: | ||
:no-inherited-members: | ||
:no-special-members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.. _qiskit-machine-learning-utils: | ||
|
||
.. automodule:: qiskit_machine_learning.utils | ||
:no-members: | ||
:no-inherited-members: | ||
:no-special-members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
:orphan: | ||
|
||
############### | ||
Getting started | ||
############### | ||
|
||
Installation | ||
============ | ||
|
||
Qiskit Machine Learning depends on Qiskit, which has its own | ||
`Qiskit Getting Started <https://qiskit.org/documentation/getting_started.html>`__ detailing | ||
installation options and its supported environments/platforms. You should refer to | ||
that first. Then the information here can be followed which focuses on the additional installation | ||
specific to Qiskit Machine Learning. | ||
|
||
Qiskit Machine Learning has some functions that have been made optional where the dependent code and/or | ||
support program(s) are not (or cannot be) installed by default. Those are PyTorch and Sparse. | ||
See :ref:`optional_installs` for more information. | ||
|
||
.. tab-set:: | ||
|
||
.. tab-item:: Start locally | ||
|
||
The simplest way to get started is to first follow the `getting started 'Start locally' guide for | ||
Qiskit <https://qiskit.org/documentation/getting_started.html>`__ | ||
|
||
In your virtual environment, where you installed Qiskit, install Qiskit Machine Learning as follows: | ||
|
||
.. code:: sh | ||
pip install qiskit-machine-learning | ||
.. note:: | ||
|
||
As Qiskit Machine Learning depends on Qiskit, you can though simply install it into your | ||
environment, as above, and pip will automatically install a compatible version of Qiskit | ||
if one is not already installed. | ||
|
||
.. tab-item:: Install from source | ||
|
||
Installing Qiskit Machine Learning from source allows you to access the most recently | ||
updated version under development instead of using the version in the Python Package | ||
Index (PyPI) repository. This will give you the ability to inspect and extend | ||
the latest version of the Qiskit Machine Learning code more efficiently. | ||
|
||
Since Qiskit Machine Learning depends on Qiskit, and its latest changes may require new or changed | ||
features of Qiskit, you should first follow Qiskit's `"Install from source"` instructions | ||
here `Qiskit Getting Started <https://qiskit.org/documentation/getting_started.html>`__ | ||
|
||
.. raw:: html | ||
|
||
<h2>Installing Qiskit Machine Learning from Source</h2> | ||
|
||
Using the same development environment that you installed Qiskit in you are ready to install | ||
Qiskit Machine Learning. | ||
|
||
1. Clone the Qiskit Machine Learning repository. | ||
|
||
.. code:: sh | ||
git clone https://github.com/qiskit-community/qiskit-machine-learning.git | ||
2. Cloning the repository creates a local folder called ``qiskit-machine-learning``. | ||
|
||
.. code:: sh | ||
cd qiskit-machine-learning | ||
3. If you want to run tests or linting checks, install the developer requirements. | ||
|
||
.. code:: sh | ||
pip install -r requirements-dev.txt | ||
4. Install ``qiskit-machine-learning``. | ||
|
||
.. code:: sh | ||
pip install . | ||
If you want to install it in editable mode, meaning that code changes to the | ||
project don't require a reinstall to be applied, you can do this with: | ||
|
||
.. code:: sh | ||
pip install -e . | ||
.. _optional_installs: | ||
|
||
Optional installs | ||
================= | ||
|
||
* **PyTorch**, may be installed either using command ``pip install 'qiskit-machine-learning[torch]'`` to install the | ||
package or refer to PyTorch `getting started <https://pytorch.org/get-started/locally/>`__. When PyTorch | ||
is installed, the `TorchConnector` facilitates its use of quantum computed networks. | ||
|
||
* **Sparse**, may be installed using command ``pip install 'qiskit-machine-learning[sparse]'`` to install the | ||
package. Sparse being installed will enable the usage of sparse arrays/tensors. | ||
|
||
---- | ||
|
||
Ready to get going?... | ||
====================== | ||
|
||
.. raw:: html | ||
|
||
<div class="tutorials-callout-container"> | ||
<div class="row"> | ||
|
||
.. qiskit-call-to-action-item:: | ||
:description: Find out about Qiskit Machine Learning. | ||
:header: Dive into the tutorials | ||
:button_link: ./tutorials/index.html | ||
:button_text: Qiskit Machine Learning tutorials | ||
|
||
.. raw:: html | ||
|
||
</div> | ||
</div> | ||
|
||
|
||
.. Hiding - Indices and tables | ||
:ref:`genindex` | ||
:ref:`modindex` | ||
:ref:`search` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
##################################### | ||
Qiskit Machine Learning overview | ||
##################################### | ||
|
||
Overview | ||
============== | ||
|
||
Qiskit Machine Learning introduces fundamental computational building blocks - such as Quantum Kernels | ||
and Quantum Neural Networks - used in different applications, including classification and regression. | ||
On the one hand, this design is very easy to use and allows users to rapidly prototype a first model | ||
without deep quantum computing knowledge. On the other hand, Qiskit Machine Learning is very flexible, | ||
and users can easily extend it to support cutting-edge quantum machine learning research. | ||
|
||
Qiskit Machine Learning provides the :class:`~qiskit_machine_learning.kernels.FidelityQuantumKernel` | ||
class class that makes use of the :class:`~qiskit_algorithms.state_fidelities.BaseStateFidelity` algorithm | ||
introduced in Qiskit and can be easily used to directly compute kernel matrices for given datasets | ||
or can be passed to a Quantum Support Vector Classifier | ||
(:class:`~qiskit_machine_learning.algorithms.QSVC`) or | ||
Quantum Support Vector Regressor (:class:`~qiskit_machine_learning.algorithms.QSVR`) | ||
to quickly start solving classification or regression problems. | ||
It also can be used with many other existing kernel-based machine learning algorithms from established | ||
classical frameworks. | ||
|
||
Qiskit Machine Learning defines a generic interface for neural networks that is implemented by different | ||
quantum neural networks. Two core implementations are readily provided, such as the | ||
:class:`~qiskit_machine_learning.neural_networks.EstimatorQNN` | ||
and the :class:`~qiskit_machine_learning.neural_networks.SamplerQNN`. | ||
The :class:`~qiskit_machine_learning.neural_networks.EstimatorQNN` leverages | ||
the :class:`~qiskit.primitives.BaseEstimator` primitive from Qiskit and allows users to combine | ||
parametrized quantum circuits with quantum mechanical observables. The circuits can be constructed | ||
using, for example, building blocks from Qiskit's circuit library, and the QNN's output is given | ||
by the expected value of the observable. | ||
The :class:`~qiskit_machine_learning.neural_networks.SamplerQNN` leverages another primitive | ||
introduced in Qiskit, the :class:`~qiskit.primitives.BaseSampler` primitive. This neural network | ||
translates quasi-probabilities of bitstrings estimated by the primitive into a desired output. This | ||
translation step can be used to interpret a given bitstring in a particular context, e.g. | ||
translating it into a set of classes. | ||
|
||
The neural networks include the functionality to evaluate them for a given input as well as to compute the | ||
corresponding gradients, which is important for efficient training. To train and use neural networks, | ||
Qiskit Machine Learning provides a variety of learning algorithms such as the | ||
:class:`~qiskit_machine_learning.algorithms.NeuralNetworkClassifier` and | ||
:class:`~qiskit_machine_learning.algorithms.NeuralNetworkRegressor`. | ||
Both take a QNN as input and then use it in a classification or regression context. | ||
To allow an easy start, two convenience implementations are provided - the Variational Quantum Classifier | ||
(:class:`~qiskit_machine_learning.algorithms.VQC`) | ||
as well as the Variational Quantum Regressor (:class:`~qiskit_machine_learning.algorithms.VQR`). | ||
Both take just a feature map and an ansatz and construct the underlying QNN automatically. | ||
|
||
In addition to the models provided directly in Qiskit Machine Learning, it has the | ||
:class:`~qiskit_machine_learning.connectors.TorchConnector`, | ||
which allows users to integrate all of our quantum neural networks directly into the | ||
`PyTorch <https://pytorch.org>`__ | ||
open source machine learning library. Thanks to Qiskit Algorithm's gradient algorithms, | ||
this includes automatic | ||
differentiation - the overall gradients computed by `PyTorch <https://pytorch.org>`__ | ||
during the backpropagation take into | ||
account quantum neural networks, too. The flexible design also allows the building of connectors | ||
to other packages in the future. | ||
|
||
|
||
|
||
Next Steps | ||
================================= | ||
|
||
`Getting started <getting_started.html>`_ | ||
|
||
`Migration Guide <migration/index.html>`_ | ||
|
||
`Tutorials <tutorials/index.html>`_ | ||
|
||
.. toctree:: | ||
:hidden: | ||
|
||
Overview <self> | ||
Getting Started <getting_started> | ||
Migration Guide <migration/index> | ||
Tutorials <tutorials/index> | ||
API Reference <apidocs/qiskit_machine_learning> | ||
Release Notes <release_notes> | ||
GitHub <https://github.com/qiskit-community/qiskit-machine-learning> | ||
|
||
|
||
|
||
.. Hiding - Indices and tables | ||
:ref:`genindex` | ||
:ref:`modindex` | ||
:ref:`search` | ||