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
    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$ Mar 29, 2021 at 1:43

1 Answer 1


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$ 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$ 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
    Mar 30, 2021 at 7:13
  • $\begingroup$ thank you for the motivation. $\endgroup$ Mar 31, 2021 at 2:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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