Not getting the expected results

I have tried with example, but am not getting the results as given in the example. I have attached the accuracy and loss results that I have obtained for your reference.

Code.py (5.9 KB)

Hi @Mubarak,

Based on the code file you attached, it looks like you’re running the example code exactly as in the demo, correct?

My first recommendation is to make sure PennyLane is update to the latest version (which, as of the release today, is 0.15), and give it another go.

My second thought is that it could just be a difference due to randomness, however I see that both numpy as tensorflow seeds are set. If you run this multiple times on your, do you always receive the exact same output?

Yes @glassnotes
I am working on the demo code. I have installed the latest version of PellyLane.

Actually in the code, due to the lines (seed value is reset condition)
np.random.seed(0)
tf.random.set_seed(0)

I would be getting the same accuracy and loss results for fixed epoch, train, and test images previously. Now I have commented on these lines in the code and getting different accuracy and loss values due to randomness.

Also, it would be grateful if u suggest how to stop my execution for maximum accuracy and minimum loss.

Thanks for your help… Keep on helping and grow more…

Hi @Mubarak,

I have run the demo locally, and find that I get the same results as you, and that the version on the webpage is different. I’ve opened an issue so that we can look into this further.

Also, it would be grateful if u suggest how to stop my execution for maximum accuracy and minimum loss.

For this, one approach is to set up some convergence criteria for the loss. For example, if the loss from one iteration to the next does not change by more than 0.01% (just an example number), the optimization would be stopped.

Hope that helps, feel free to let us know if you have further questions!

1 Like

Thanks @glassnotes for your valuable response.

No problem, it is our pleasure! :slight_smile: Thanks for bringing up the issue with the demo output; details about any further updates to it will be in the Github issue I linked.