I am trying to practice QSVM from the following tutorial

Introduction into Quantum Support Vector Machines

The author has used 2 feature_dimension with 2 component PCA

feature_dimension =2

Now my question is, why?

Is it because of the limitation of the number of qubits?

When I tried to increase both to 3 the testing success ratio decreased to 0.45

How can I use more feature sets

  • $\begingroup$ PCA is used to reduce the 32 features of the dataset to 2. Therefore, after PCA feature_dimension = PCA_dim = 2. $\endgroup$
    – Cuhrazatee
    Commented Mar 28, 2021 at 23:40
  • $\begingroup$ Yes that I understand. Is there any practical cause of doing that? What is my data has more features? Thanks $\endgroup$ Commented Mar 29, 2021 at 1:43

2 Answers 2


Practically, it can be (quite often) a limitation of number of qubits/hardware, but also it is a hyperparameter to play with. So it may be that using more qubits gives you better results or worse.

Also, in the QSVM, there is or may be a parameterized part you have to optimize over. So increasing the number of qubits results in more optimization (more parameters), that makes it harder. You may need to play on the depth of the variational part to improve results (so more parameters to optimize).

But if you are limited in the number of qubits, you can change the data encoding. For instance, in this paper Fig.2, they use a quantum circuit with $17$ qubits and loaded $67-$dimensional data without dimensionality reduction. This results in a deeper circuit.

  • $\begingroup$ I cannot thank you enough for the reference paper that you attached, I am going through it. $\endgroup$ Commented Mar 29, 2021 at 20:06
  • $\begingroup$ I read through the paper still did not get a full grasp of it. Anyway, I am looking to implement a similar algorithm using the QISKIT library. Let's see. Any idea of using something other than QSVM also? VQE maybe or? $\endgroup$ Commented Mar 29, 2021 at 21:03
  • $\begingroup$ @ProtimaRaniPaul It does not hurt to try a bit of everything but you should not be afraid of getting your hands dirty with code. Most of things need more implementation. If you think Qiskit is restrictive, you can try pennylane or another framework. $\endgroup$
    – cnada
    Commented Mar 30, 2021 at 7:13
  • $\begingroup$ thank you for the motivation. $\endgroup$ Commented Mar 31, 2021 at 2:16

Maybe this article can help you: 'Automatic design of quantum feature maps', Sergio Altares-López, Angela Ribeiro and Juan José García-Ripoll, 19 August 2021 - https://doi.org/10.1088/2058-9565/ac1ab1.

They describe a technique to generate optimal quantum feature maps by using multiobjetives genetic algorithms. While the first objective is to increase the accuracy in the predictions on unseen data, building robust classifiers with generalisation power; the second objective of this technique is to reduce the complexity of the quantum circuits.

In this study they utilize 22 features in a quantum model, so it might help you.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.