Skip to content

QCNN for multi class classification using NeuralNetworkClassifier #914

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Atharv-02 opened this issue May 4, 2025 · 4 comments
Open
Labels
Performance ⚡ improve code perfomance (memory or speed) type: question 🙋 Question about the code or its uses

Comments

@Atharv-02
Copy link

Atharv-02 commented May 4, 2025

Hi Team,
I am trying to perform multi class image classification on the MNIST dataset from tensorflow using QCNN but I am getting error while using Sampler QNN and Neural Network classifier
Please see the notebook or more details
https://www.kaggle.com/code/atharvgulati/qcnn-mnist

@Atharv-02 Atharv-02 changed the title QCNN for multi class classification QCNN for multi class classification using NeuralNetworkClassifier May 4, 2025
@woodsp-ibm
Copy link
Member

There is nothing in that link

No saved version

When the author of the notebook creates a saved version, it will appear here.

If you are using (have installed) the latest Qiskit 2,0 then that is known not to work as ML does not support version 2.0 or above yet. You need to install the latest prior version which at the time I type this it's 1.4.2 so

pip install qiskit==1.4.2

If things still fail then and you believe its an issue with ML then update this issue and put all the relevant details here such as a code sample to reproduce the failure, details of the failure etc.

@Atharv-02
Copy link
Author

@woodsp-ibm
I am really sorry for not putting it accurately -
I have you used qiskit 1.4.2
You can check here

https://colab.research.google.com/drive/1FYulE4FtoRvuSA9B49dxWKYU79y5inXp?usp=sharing

Please help me out
Problem - The last cell is not running - I am not getting the callback graph as output

@woodsp-ibm
Copy link
Member

Whatever you put there was not run

Image

Its not that much different from the tutorial here https://qiskit-community.github.io/qiskit-machine-learning/tutorials/11_quantum_convolutional_neural_networks.html which I guess its a copy of. The only things I notice is that your initial point would be random, which I guess is ok. Also you are using one_hot encoding which the tutorial is not. Does changing that to False make any difference. Do those cells get executed ok - certainly in what was uploaded there is no output but then it says the cells were not executed. Does it error - does the print of the final result not happen.... ie the fit fails for some reason?

@Atharv-02
Copy link
Author

Atharv-02 commented May 7, 2025

Hi @woodsp-ibm
Thanks a lot for your response
so as the title mentioned, I am trying this for multi class classification problem. So I have used one hot encoding and the documentation of NeeuralNetworkClassifier also says the same - to set one_hot=True for multi class problem

It is just continuously executing on fit and does not go further

Image

It goes like this for hours without showing any graph/output

Please help

@edoaltamura edoaltamura added Performance ⚡ improve code perfomance (memory or speed) type: question 🙋 Question about the code or its uses labels May 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Performance ⚡ improve code perfomance (memory or speed) type: question 🙋 Question about the code or its uses
Projects
None yet
Development

No branches or pull requests

3 participants