Hello, how is a real quantum computer used in variatonal quantum amchine learning algorithm?

Hi @gizmo! Thank you for your question.

Like standard quantum circuits, variational quantum algorithms (aka parameterized quantum circuits or quantum neural networks) consist of three ingredients:

- Preparing an initial state (the zero state in general).
- A quantum circuit U(θ), which is parameterized by a set of free parameters θ.
- Measurement of an observable (referred to as B) at the output. This observable may be made up of local observables for each wire in the circuit, or just a subset of wires.

We generally adjust the parameters θ by applying quantum gates in a way that will provide us with the final result (or measurement of an observable, B) that we desire. For variational algorithms, the quantum circuit contains three steps; A Cricut Ansatz, cos-function, and training procedure.

After you develop your algorithm taking into consideration the steps and ingredients, it should be ready to run on quantum hardware, but first, we recommend testing it on a simulator to check for any issues in your code.

To learn more on this, you can check out: Variational circuits, Variational Quantum Algorithms

Thanks @Togan, so all 3 steps in your list there run on the hardware? even the observable? also thank you for the resources.

You’re welcome!

Yes, the measurement can be implemented on the quantum hardware, where you can measure the final state of the qubits, with the probabilities of obtaining the two possible outcomes 0 and 1. PennyLane can extract different types of measurement results from quantum devices, like the expectation of an observable, its variance, samples of a single measurement, or computational basis state probabilities.

You’re welcome, and thank you for using the Discussion Forum