quantum
**Quantum Machine Learning**
**What is Quantum ML?**
Using quantum computers for machine learning tasks, potentially offering speedups for certain algorithms.
**Quantum Computing Basics**
| Concept | Description |
|---------|-------------|
| Qubit | Quantum bit (superposition of 0 and 1) |
| Superposition | State can be both 0 and 1 |
| Entanglement | Qubits correlated across distance |
| Interference | Amplify correct answers |
| Decoherence | Quantum state collapse (noise) |
**Quantum Hardware**
| Company | Qubits | Type |
|---------|--------|------|
| IBM | 1000+ | Superconducting |
| Google | 100 | Superconducting |
| IonQ | 32 | Trapped ion |
| Rigetti | 84 | Superconducting |
| D-Wave | 5000+ | Quantum annealing |
**QML Approaches**
**Variational Quantum Circuits**
```python
import pennylane as qml
dev = qml.device("default.qubit", wires=4)
@qml.qnode(dev)
def quantum_classifier(inputs, weights):
# Encode classical data
qml.AngleEmbedding(inputs, wires=range(4))
# Parameterized quantum layers
qml.StronglyEntanglingLayers(weights, wires=range(4))
# Measurement
return qml.expval(qml.PauliZ(0))
# Train like classical NN
optimizer = qml.GradientDescentOptimizer()
for epoch in range(100):
weights = optimizer.step(cost_fn, weights)
```
**Quantum Kernels**
Use quantum computer to compute kernel for SVM:
```python
from qiskit_machine_learning.kernels import FidelityQuantumKernel
kernel = FidelityQuantumKernel(feature_map=ZZFeatureMap(4))
svc = SVC(kernel=kernel.evaluate)
svc.fit(X_train, y_train)
```
**Current Limitations**
| Limitation | Impact |
|------------|--------|
| Noise (NISQ era) | Limits circuit depth |
| Qubit count | Small problems only |
| Error correction | Not yet scalable |
| Classical simulation | Can simulate small circuits |
**Realistic Timeline**
| Milestone | Estimated |
|-----------|-----------|
| Quantum advantage (contrived) | Now |
| Useful advantage | 2028-2035 |
| Large-scale QML | 2035+ |
**Where to Experiment**
| Platform | Access |
|----------|--------|
| IBM Quantum | Free tier |
| Amazon Braket | AWS |
| Google Cirq | Simulator + hardware |
| Xanadu Cloud | Photonic |
**Best Practices**
- Great for research/learning
- Use hybrid classical-quantum approaches
- Start with simulators
- Watch for practical advantages
- Consider for specific algorithms (optimization)