Skip to content

Commit 30dad80

Browse files
Revamp readme pt2 (#822)
* Restructure README.md --------- Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com>
1 parent 094b994 commit 30dad80

File tree

4 files changed

+168
-132
lines changed

4 files changed

+168
-132
lines changed

.pylintdict

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ armijo
2323
arxiv
2424
asmatrix
2525
aspuru
26+
assertraises
2627
async
2728
autoencoder
2829
autoencoders
@@ -158,6 +159,7 @@ farhi
158159
farrokh
159160
fi
160161
fidelities
162+
fidelity
161163
fidelityquantumkernel
162164
filippo
163165
fletcher
@@ -201,13 +203,15 @@ hadfield
201203
hamiltonian
202204
hamiltonians
203205
hao
206+
hartree
204207
hashable
205208
hatano
206209
havlíček
207210
heidelberg
208211
hessians
209212
hilbert
210213
hoc
214+
homebrew
211215
hopkins
212216
hoyer
213217
html
@@ -259,6 +263,7 @@ kwargs
259263
labelled
260264
lagrange
261265
langle
266+
linux
262267
larrañaga
263268
lcu
264269
len
@@ -452,10 +457,12 @@ rhs
452457
rightarrow
453458
robert
454459
romero
460+
rosenbrock
455461
rosen
456462
runarsson
457463
runtime
458464
runtimes
465+
RuntimeError
459466
rx
460467
ry
461468
rz
@@ -495,6 +502,9 @@ sqrt
495502
statefn
496503
statevector
497504
statevectors
505+
stdlib
506+
stdout
507+
stfc
498508
stddev
499509
stdlib
500510
stdout
@@ -594,7 +604,3 @@ zz
594604
θ
595605
ψ
596606
ω
597-
assertRaises
598-
RuntimeError
599-
Rosenbrock
600-
fidelities

README.md

Lines changed: 79 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -12,103 +12,105 @@
1212

1313
## What is Qiskit Machine Learning?
1414

15-
Qiskit Machine Learning introduces fundamental computational building blocks, such as Quantum Kernels
16-
and Quantum Neural Networks, used in different applications, including classification and regression.
17-
On the one hand, this design is very easy to use and allows users to rapidly prototype a first model
18-
without deep quantum computing knowledge. On the other hand, Qiskit Machine Learning is very flexible,
19-
and users can easily extend it to support cutting-edge quantum machine learning research.
15+
Qiskit Machine Learning introduces fundamental computational building blocks, such as Quantum
16+
Kernels and Quantum Neural Networks, used in various applications including classification
17+
and regression.
18+
19+
This library is part of the Qiskit Community ecosystem, a collection of high-level codes that are based
20+
on the Qiskit software development kit. As of version `0.7.0`, Qiskit Machine Learning is co-maintained
21+
by IBM and the Hartree Center, part of the UK Science and Technologies Facilities Council (STFC).
22+
23+
The Qiskit Machine Learning framework aims to be:
24+
25+
* **User-friendly**, allowing users to quickly and easily prototype quantum machine learning models without
26+
the need of extensive quantum computing knowledge.
27+
* **Flexible**, providing tools and functionalities to conduct proof-of-concepts and innovative research
28+
in quantum machine learning for both beginners and experts.
29+
* **Extensible**, facilitating the integration of new cutting-edge features leveraging Qiskit's
30+
architectures, patterns and related services.
31+
2032

2133
## What are the main features of Qiskit Machine Learning?
2234

23-
Qiskit Machine Learning provides the
24-
[FidelityQuantumKernel](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.kernels.QuantumKernel.html#qiskit_machine_learning.kernels.FidelityQuantumKernel)
25-
class that makes use of the [Fidelity](https://qiskit-community.github.io/qiskit-algorithms/stubs/qiskit_algorithms.state_fidelities.BaseStateFidelity.html) algorithm introduced in Qiskit Algorithms and can be easily used
26-
to directly compute kernel matrices for given datasets or can be passed to a Quantum Support Vector Classifier
27-
[QSVC](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.algorithms.QSVC.html#qiskit_machine_learning.algorithms.QSVC) or
28-
Quantum Support Vector Regressor
29-
[QSVR](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.algorithms.QSVR.html#qiskit_machine_learning.algorithms.QSVR)
30-
to quickly start solving classification or regression problems.
31-
It also can be used with many other existing kernel-based machine learning algorithms from established
32-
classical frameworks.
33-
34-
Qiskit Machine Learning defines a generic interface for neural networks that is implemented by different
35-
quantum neural networks. Two core implementations are readily provided, such as the
36-
[EstimatorQNN](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.neural_networks.EstimatorQNN.html),
37-
and the [SamplerQNN](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.neural_networks.SamplerQNN.html).
38-
The [EstimatorQNN](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.neural_networks.EstimatorQNN.html)
39-
leverages the [Estimator](https://docs.quantum.ibm.com/api/qiskit/qiskit.primitives.BaseEstimator) primitive from Qiskit and
40-
allows users to combine parametrized quantum circuits with quantum mechanical observables. The circuits can be constructed using, for example, building blocks
41-
from Qiskit’s circuit library, and the QNN’s output is given by the expected value of the observable.
42-
The [SamplerQNN](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.neural_networks.SamplerQNN.html)
43-
leverages another primitive introduced in Qiskit, the [Sampler](https://docs.quantum.ibm.com/api/qiskit/qiskit.primitives.BaseSampler) primitive.
44-
This neural network translates quasi-probabilities of bitstrings estimated by the primitive into a desired output. This
45-
translation step can be used to interpret a given bitstring in a particular context, e.g. translating it into a set of classes.
46-
47-
The neural networks include the functionality to evaluate them for a given input as well as to compute the
48-
corresponding gradients, which is important for efficient training. To train and use neural networks,
49-
Qiskit Machine Learning provides a variety of learning algorithms such as the
50-
[NeuralNetworkClassifier](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.algorithms.NeuralNetworkClassifier.html#qiskit_machine_learning.algorithms.NeuralNetworkClassifier)
51-
and
52-
[NeuralNetworkRegressor](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.algorithms.NeuralNetworkRegressor.html#qiskit_machine_learning.algorithms.NeuralNetworkRegressor).
53-
Both take a QNN as input and then use it in a classification or regression context.
54-
To allow an easy start, two convenience implementations are provided - the Variational Quantum Classifier
55-
[VQC](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.algorithms.VQC.html#qiskit_machine_learning.algorithms.VQC)
56-
as well as the Variational Quantum Regressor
57-
[VQR](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.algorithms.VQR.html#qiskit_machine_learning.algorithms.VQR).
58-
Both take just a feature map and an ansatz and construct the underlying QNN automatically.
59-
60-
In addition to the models provided directly in Qiskit Machine Learning, it has the
61-
[TorchConnector](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.connectors.TorchConnector.html#qiskit_machine_learning.connectors.TorchConnector),
62-
which allows users to integrate all of our quantum neural networks directly into the
63-
[PyTorch](https://pytorch.org)
64-
open source machine learning library. Thanks to Qiskit’s gradient algorithms, this includes automatic
65-
differentiation - the overall gradients computed by [PyTorch](https://pytorch.org)
66-
during the backpropagation take into
67-
account quantum neural networks, too. The flexible design also allows the building of connectors
68-
to other packages in the future.
69-
70-
## Installation
71-
72-
We encourage installing Qiskit Machine Learning via the pip tool (a python package manager).
35+
### Kernel-based methods
36+
37+
The [`FidelityQuantumKernel`](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.kernels.QuantumKernel.html#qiskit_machine_learning.kernels.FidelityQuantumKernel)
38+
class uses the [`Fidelity`](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.state_fidelities.BaseStateFidelity.html))
39+
algorithm. 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))
40+
or 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))
41+
to solve classification or regression problems respectively. It is also compatible with classical kernel-based machine learning algorithms.
42+
43+
44+
### Quantum Neural Networks (QNNs)
45+
46+
Qiskit Machine Learning defines a generic interface for neural networks, implemented by two core (derived) primitives:
47+
48+
- **[`EstimatorQNN`](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.neural_networks.EstimatorQNN.html):** Leverages the [`Estimator`](https://docs.quantum.ibm.com/api/qiskit/qiskit.primitives.BaseEstimator) primitive, combining parametrized quantum circuits with quantum mechanical observables. The output is the expected value of the observable.
49+
50+
- **[`SamplerQNN`](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.neural_networks.SamplerQNN.html):** Leverages the [`Sampler`](https://docs.quantum.ibm.com/api/qiskit/qiskit.primitives.BaseSampler) primitive, translating bit-string counts into the desired outputs.
51+
52+
To 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)
53+
and [`NeuralNetworkRegressor`](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.algorithms.NeuralNetworkRegressor.html#qiskit_machine_learning.algorithms.NeuralNetworkRegressor).
54+
Finally, 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))
55+
and 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))
56+
take a _feature map_ and an _ansatz_ to construct the underlying QNN automatically using high-level syntax.
57+
58+
### Integration with PyTorch
59+
60+
The [`TorchConnector`](https://qiskit-community.github.io/qiskit-machine-learning/stubs/qiskit_machine_learning.connectors.TorchConnector.html#qiskit_machine_learning.connectors.TorchConnector)
61+
integrates QNNs with [PyTorch](https://pytorch.org).
62+
Thanks to the gradient algorithms in Qiskit Machine Learning, this includes automatic differentiation.
63+
The overall gradients computed by PyTorch during the backpropagation take into account quantum neural
64+
networks, too. The flexible design also allows the building of connectors to other packages in the future.
65+
66+
## Installation and documentation
67+
68+
We encourage installing Qiskit Machine Learning via the `pip` tool, a `Python` package manager.
7369

7470
```bash
7571
pip install qiskit-machine-learning
7672
```
7773

78-
**pip** will handle all dependencies automatically and you will always install the latest
79-
(and well-tested) version.
74+
`pip` will install all dependencies automatically, so that you will always have the most recent
75+
stable version.
8076

81-
If you want to work on the very latest work-in-progress versions, either to try features ahead of
82-
their official release or if you want to contribute to Machine Learning, then you can install from source.
83-
To do this follow the instructions in the
77+
If you want to work instead on the very latest _work-in-progress_ versions of Qiskit Machine Learning,
78+
either to try features ahead of
79+
their official release or if you want to contribute to the library, then you can install from source.
80+
For more details on how to do so and much more, follow the instructions in the
8481
[documentation](https://qiskit-community.github.io/qiskit-machine-learning/getting_started.html#installation).
8582

8683
### Optional Installs
8784

88-
* **PyTorch**, may be installed either using command `pip install 'qiskit-machine-learning[torch]'` to install the
85+
* **PyTorch** may be installed either using command `pip install 'qiskit-machine-learning[torch]'` to install the
8986
package or refer to PyTorch [getting started](https://pytorch.org/get-started/locally/). When PyTorch
9087
is installed, the `TorchConnector` facilitates its use of quantum computed networks.
9188

92-
* **Sparse**, may be installed using command `pip install 'qiskit-machine-learning[sparse]'` to install the
93-
package. Sparse being installed will enable the usage of sparse arrays/tensors.
89+
* **Sparse** may be installed using command `pip install 'qiskit-machine-learning[sparse]'` to install the
90+
package. Sparse being installed will enable the usage of sparse arrays and tensors.
91+
92+
* **NLopt** is required for the global optimizers. [`NLopt`](https://nlopt.readthedocs.io/en/latest/)
93+
can be installed manually with `pip install nlopt` on Windows and Linux platforms, or with `brew
94+
install nlopt` on MacOS using the Homebrew package manager. For more information,
95+
refer to the [installation guide](https://nlopt.readthedocs.io/en/latest/NLopt_Installation/).
9496

9597
## Migration to Qiskit 1.x
9698
> [!NOTE]
97-
> Qiskit Machine Learning learning depends on Qiskit, which will be automatically installed as a
98-
> dependency when you install Qiskit Machine Learning. If you have a pre-`1.0` version of Qiskit
99-
> installed in your environment (however it was installed), and wish to upgrade to `1.0`, you
100-
> should take note of the
99+
> Qiskit Machine Learning depends on Qiskit, which will be automatically installed as a
100+
> dependency when you install Qiskit Machine Learning. From version `0.8.0` of Qiskit Machine
101+
> Learning, Qiskit `1.0` or above will be required. If you have a pre-`1.0` version of Qiskit
102+
> installed in your environment (however it was installed), you should upgrade to `1.x` to
103+
> continue using the latest features. You may refer to the
101104
> official [Qiskit 1.0 Migration Guide](https://docs.quantum.ibm.com/api/migration-guides/qiskit-1.0)
102-
> for detailed instructions and examples on how to upgrade.
105+
> for detailed instructions and examples on how to upgrade Qiskit.
103106
104107
----------------------------------------------------------------------------------------------------
105108

106109
### Creating Your First Machine Learning Programming Experiment in Qiskit
107110

108-
Now that Qiskit Machine Learning is installed, it's time to begin working with the Machine Learning module.
109-
Let's try an experiment using VQC (Variational Quantum Classifier) algorithm to
110-
train and test samples from a data set to see how accurately the test set can
111-
be classified.
111+
Now that Qiskit Machine Learning is installed, it's time to begin working with the Machine
112+
Learning module. Let's try an experiment using VQC (Variational Quantum Classifier) algorithm to
113+
train and test samples from a data set to see how accurately the test set can be classified.
112114

113115
```python
114116
from qiskit.circuit.library import TwoLocal, ZZFeatureMap
@@ -177,9 +179,11 @@ For questions that are more suited for a forum, we use the **Qiskit** tag in [St
177179

178180
## Humans behind Qiskit Machine Learning
179181

180-
Qiskit Machine Learning was inspired, authored and brought about by the collective work of a team of researchers
181-
and software engineers. This library continues to grow with the help and work of
182-
[many people](https://github.com/qiskit-community/qiskit-machine-learning/graphs/contributors), who contribute to the project at different levels.
182+
Qiskit Machine Learning was inspired, authored and brought about by the collective work of a
183+
team of researchers and software engineers. This library continues to grow with the help and
184+
work of
185+
[many people](https://github.com/qiskit-community/qiskit-machine-learning/graphs/contributors),
186+
who contribute to the project at different levels.
183187

184188
## How can I cite Qiskit Machine Learning?
185189
If you use Qiskit, please cite as per the provided

docs/getting_started.rst

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ that first. Then the information here can be followed which focuses on the addit
1414
specific to Qiskit Machine Learning.
1515

1616
Qiskit Machine Learning has some functions that have been made optional where the dependent code and/or
17-
support program(s) are not (or cannot be) installed by default. Those are PyTorch and Sparse.
17+
support program(s) are not (or cannot be) installed by default. Those are PyTorch, Sparse and NLopt.
1818
See :ref:`optional_installs` for more information.
1919

2020
.. tab-set::
@@ -97,6 +97,27 @@ Optional installs
9797
* **Sparse**, may be installed using command ``pip install 'qiskit-machine-learning[sparse]'`` to install the
9898
package. Sparse being installed will enable the usage of sparse arrays/tensors.
9999

100+
* **NLopt** is required for the global optimizers. `NLOpt <https://nlopt.readthedocs.io/en/latest/>`__
101+
can be installed manually with ``pip install nlopt`` on Windows and Linux platforms, or with
102+
``brew install nlopt`` on MacOS using the Homebrew package manager. For more information, refer
103+
to the `installation guide <https://nlopt.readthedocs.io/en/latest/NLopt_Installation/>`__.
104+
105+
.. _migration-to-qiskit-1x:
106+
107+
Migration to Qiskit 1.x
108+
========================
109+
110+
.. note::
111+
112+
Qiskit Machine Learning depends on Qiskit, which will be automatically installed as a
113+
dependency when you install Qiskit Machine Learning. From version ``0.8.0`` of Qiskit Machine
114+
Learning, Qiskit ``1.0`` or above will be required. If you have a pre-``1.0`` version of Qiskit
115+
installed in your environment (however it was installed), you should upgrade to ``1.x`` to
116+
continue using the latest features. You may refer to the
117+
official `Qiskit 1.0 Migration Guide <https://docs.quantum.ibm.com/api/migration-guides/qiskit-1.0>`_
118+
for detailed instructions and examples on how to upgrade Qiskit.
119+
120+
100121
----
101122

102123
Ready to get going?...

0 commit comments

Comments
 (0)