I am using qiskit's VQC to build a classifier. Dimensionality of the data is 2 and number of classes are 4. The feature map I used is ZZFeatureMap and ansatz is the RealAplitudes. Then entanglement and reps are "full" and 2 respectively for both feature map and ansatz. Optimizer used is 'COBYLA'. Please find below the respective code.

enter image description here

When I try to fit the classifier, it is not optimising the weights and the loss is always "nan". It is stopping after 7 iterations.

enter image description here

What am I doing wrong and how can I train a classifier using qiskit's VQC ? Thank you!

  • $\begingroup$ Try to change your optimizer and see if that changes anything, $\endgroup$
    – KAJ226
    Oct 19 '21 at 19:49
  • $\begingroup$ I did, I tried with ADAM and AMSGRAD too. I can't be help but think I am missing something basic somewhere. $\endgroup$ Oct 21 '21 at 1:24
  • $\begingroup$ I strongly believe it is to do with the number of classes the dataset has. Upon trying a tutorial of qiskit on this topic, everything worked well until I changed the dataset to include more classes. I have elaborated on this here: quantumcomputing.stackexchange.com/questions/21661/… $\endgroup$ Oct 24 '21 at 18:45

Your Answer

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

Browse other questions tagged or ask your own question.