Quantum ML Series 2: Training a Quantum Classifier

This title was summarized by AI from the post below.

-- Quantum ML Series 2 | Post 07 of 11 #QFD2 -- Post 6 ended with a working forward pass. Post 7 closes the loop. Today we train the quantum classifier for the first time. Here is what we built: A complete hybrid quantum-classical model. The quantum circuit handles feature processing. A classical linear layer maps the 16 quantum outputs to 10 digit class probabilities. Both components train together end to end. Cross entropy loss. Adam optimizer at 0.01 learning rate. 10 epochs. 500 training images. The training loop looks like standard PyTorch. Zero gradients. Forward pass. Compute loss. Call loss.backward(). Step the optimizer. The quantum specific part is invisible at this level. PennyLane handles the parameter shift rule gradient computation automatically. Gradients flow through the quantum circuit just like they flow through any classical layer. Honest results from my run: After 10 epochs on 500 training images the loss went from 2.29 down to 1.61. Test accuracy: approximately 35 to 45 percent. Random chance on a 10 class problem is 10 percent. So the model learned something real. But a classical logistic regression on the same 16 features would likely hit 60 to 70 percent. A classical CNN on the full image would hit 99 percent plus. I am sharing the exact numbers, not the best case. That is the point of learning in public. One honest observation. Training a quantum circuit is slow. Each backward pass runs the circuit twice per parameter for the parameter shift rule. With 32 quantum parameters that is a lot of circuit evaluations per batch. We trained on 500 images for practical reasons. The full 60,000 image MNIST training set would take a very long time on a laptop simulator. That constraint is real. It goes in the benchmark comparison in Post 8. Full article with all explanations below. https://lnkd.in/gBgf7avB Article link in first comment 👇 I am also currently open to full stack development and quantum computing opportunities. Six years of coding experience. Building in QML. Looking for a team working on something technically interesting. If that sounds like your team, feel free to reach out or connect. #QuantumComputing #QuantumML #MachineLearning #LearnInPublic #Developer #PennyLane #QML #Coding #FutureTech #QuantumMLSeries #OpenToWork #FullStackDeveloper

  • diagram

Article 7 -> https://www.linkedin.com/pulse/training-quantum-neural-network-amit-kumar-eyffc New here? This is Series 2: Quantum ML for Developers. Start with Series 1 (Quantum Computing for Developers) first: linkedin.com/feed/update/urn:li:activity:7436025619882307584 Series 1 covers all the quantum fundamentals: qubits, superposition, entanglement, gates, circuits and algorithms. All 10 posts live. Come back here when you are ready to build.

Like
Reply

To view or add a comment, sign in

Explore content categories