Variational classifier circuit

i want to learn the variational quantum classifier on some data, please show me a good circuit to use

1 Like

Hi @anaqonda,

Welcome to the Xanadu Discussion Forum, and thank you for your request.

Finding a good circuit is definitely a challenge, and one that depends on the problem you’re trying to solve.

For context, a Quantum Variational Circuit has the following layers/structure:

  1. Embedding: In this layer, all qubits are first initialized in a balanced superposition of up and down states, then they are rotated according to the input parameters (local embedding).
  2. Variational: Here, a sequence of trainable rotation layers and constant entangling layers is applied.
  3. Measurement: For each qubit, the local expectation value of the ZZ operator is measured. This produces a classical output vector, suitable for additional post-processing.

Now that we have the high-level idea, I can give you a specific example to help.

The most in-depth and helpful tutorial I went through was probably that of Quantum Transfer Learning. It goes through an “image classifier based [method] on a hybrid classical-quantum network” in which a
pre-trained classical network is modified and
augmented by a variational quantum circuit at the end.

Perhaps your data does not involve images or classification directly, however, this shows a direct use-case of how exactly you can implement a good circuit once you play around with the problem you want to solve.

If you’re interested in more details of the problem examined in the tutorial, you can read the really informative paper on arXiv, linked here.

I hope this helps!

P.S. I really like your username!

thank you @anishrverma the links are very helpful

so my data is not images, i just want to tyr a small problem with 4-dimension clusters. can i use the same circuit as in the tutorial or is it beter to try something different? is there somewhere i can find the different types of embeddings, layer, and measurement for pennylane circuits?

1 Like

I’m glad the links helped!

To answer your latter question first, you can find embedding in the documentation here:

Similarly for the others.

You’ll notice that there are lots of methods to do the embedding, and the best one depends on your specific purposes.

Now, that being said, in the tutorial they are using image data, so knowing that you’re using 4D data, my intuition is that the code won’t work.

However, there are transformations and other things that can be done.

I recommend taking a look here:

as in the “Amplitude Embedding” section, they have a small sidenote on four dimensional data to be embedded.

I hope that the above two resources help!

great this helps very much, these docs are exactly what i was looking for. thank you again!

1 Like

Happy to help, @anaqonda; I wish you the best in your coding endeavours.

As well, I hope you enjoy your experience with Pennylane and Xanadu, and engage in the forums in the future!