Spaces:
Sleeping
Sleeping
Update GUIDE.md
Browse files
GUIDE.md
CHANGED
|
@@ -1,65 +1,137 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
---
|
| 4 |
|
| 5 |
-
##
|
| 6 |
|
| 7 |
-
The **
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
|
| 15 |
-
|
| 16 |
-
3. **Preview Table** β Shows the first 10 circuits in the split.
|
| 17 |
-
4. **Raw QASM** β Original QASM for the selected circuit.
|
| 18 |
-
5. **Transpiled QASM** β QASM after transpilation, if available.
|
| 19 |
-
6. **Info Box** β Displays dataset name and other info.
|
| 20 |
-
7. **Summary Box** β Shows number of rows in the dataset.
|
| 21 |
|
| 22 |
---
|
| 23 |
|
| 24 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
-
|
| 29 |
-
- Adjacency features (density, degree mean, etc.)
|
| 30 |
-
- QASM features (length, gate counts, measure count, etc.)
|
| 31 |
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
-
|
| 38 |
|
| 39 |
-
|
| 40 |
-
- Compute metrics:
|
| 41 |
-
- Accuracy
|
| 42 |
-
- Macro F1
|
| 43 |
-
- Weighted F1
|
| 44 |
-
- Show confusion matrix
|
| 45 |
-
- Show top 10 feature importances
|
| 46 |
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
---
|
| 50 |
|
| 51 |
-
##
|
| 52 |
|
| 53 |
-
|
|
|
|
| 54 |
|
| 55 |
-
|
| 56 |
-
2. **Feature Importance** β Most relevant features for classification.
|
| 57 |
-
3. **Metrics** β Overall classification performance.
|
| 58 |
|
| 59 |
---
|
| 60 |
|
| 61 |
-
## π
|
| 62 |
|
| 63 |
-
- [QSBench
|
| 64 |
-
-
|
| 65 |
-
-
|
|
|
|
| 1 |
+
# π QSBench: Noise Classification Guide
|
| 2 |
+
|
| 3 |
+
Welcome to the **QSBench Noise Classification Hub**.
|
| 4 |
+
This tool demonstrates how Machine Learning can distinguish different **noise conditions** in quantum circuits using only structural and topological features β without running expensive simulations.
|
| 5 |
+
|
| 6 |
+
---
|
| 7 |
+
|
| 8 |
+
## β οΈ Important: Demo Dataset Notice
|
| 9 |
+
|
| 10 |
+
This Space uses **demo shards** of the QSBench datasets.
|
| 11 |
+
|
| 12 |
+
- **Limited size**: The dataset is intentionally reduced for fast loading and demonstration.
|
| 13 |
+
- **Impact**: Model performance may be unstable or noisy, especially on the minority class.
|
| 14 |
+
- **Goal**: Showcase how circuit structure correlates with noise type β not achieve production-level accuracy.
|
| 15 |
|
| 16 |
---
|
| 17 |
|
| 18 |
+
## π§ 1. What is Being Predicted?
|
| 19 |
|
| 20 |
+
The model performs **multi-class classification** into four noise conditions:
|
| 21 |
|
| 22 |
+
### Classes
|
| 23 |
+
- **`clean`** β Ideal circuit without noise
|
| 24 |
+
- **`depolarizing`** β Uniform depolarizing noise
|
| 25 |
+
- **`amplitude_damping`** β Energy relaxation / amplitude damping
|
| 26 |
+
- **`hardware_aware`** β Realistic hardware-aware noise after transpilation
|
| 27 |
|
| 28 |
+
The task is to predict the **noise_label** from circuit features only.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
---
|
| 31 |
|
| 32 |
+
## π§© 2. How the Model βSeesβ a Circuit
|
| 33 |
+
|
| 34 |
+
The model does **not** simulate quantum states or noise channels.
|
| 35 |
+
Instead, it relies on **structural proxies**:
|
| 36 |
+
|
| 37 |
+
### πΉ Topology Features
|
| 38 |
+
- `adj_density` β How densely qubits are connected
|
| 39 |
+
- `adj_degree_mean` β Average qubit connectivity
|
| 40 |
+
- `adj_degree_std` β Variability in connectivity
|
| 41 |
|
| 42 |
+
β These reflect the **interaction graph** and entanglement potential.
|
| 43 |
+
|
| 44 |
+
### πΉ Gate Structure
|
| 45 |
+
- `total_gates`
|
| 46 |
+
- `single_qubit_gates`
|
| 47 |
+
- `two_qubit_gates`
|
| 48 |
+
- `cx_count` (or similar two-qubit counts)
|
| 49 |
+
|
| 50 |
+
β Two-qubit gates strongly influence noise sensitivity.
|
| 51 |
+
|
| 52 |
+
### πΉ Complexity Metrics
|
| 53 |
+
- `depth`
|
| 54 |
+
- `gate_entropy`
|
| 55 |
+
|
| 56 |
+
β Capture how βdeepβ and βstructuredβ the circuit is.
|
| 57 |
+
|
| 58 |
+
### πΉ QASM-derived Signals
|
| 59 |
+
- `qasm_length`
|
| 60 |
+
- `qasm_line_count`
|
| 61 |
+
- `qasm_gate_keyword_count`
|
| 62 |
+
|
| 63 |
+
β Lightweight text-based proxies for circuit complexity.
|
| 64 |
+
|
| 65 |
+
---
|
| 66 |
|
| 67 |
+
## π€ 3. Model Overview
|
|
|
|
|
|
|
| 68 |
|
| 69 |
+
The system uses:
|
| 70 |
+
|
| 71 |
+
### HistGradientBoostingClassifier
|
| 72 |
+
- Fast and accurate gradient boosting on tabular data
|
| 73 |
+
- Handles non-linear relationships well
|
| 74 |
+
- Supports `class_weight="balanced"` to deal with class imbalance
|
| 75 |
+
|
| 76 |
+
**Pipeline includes:**
|
| 77 |
+
- Median imputation for missing values
|
| 78 |
+
- Standard scaling
|
| 79 |
+
- Gradient boosting classifier
|
| 80 |
+
|
| 81 |
+
---
|
| 82 |
+
|
| 83 |
+
## π 4. Understanding the Results
|
| 84 |
+
|
| 85 |
+
After clicking **"Train & Evaluate"**, you get:
|
| 86 |
+
|
| 87 |
+
### A. Confusion Matrix
|
| 88 |
+
Shows how often each true noise type is predicted correctly or confused with others.
|
| 89 |
+
|
| 90 |
+
### B. Correct vs Incorrect
|
| 91 |
+
Simple histogram of prediction accuracy.
|
| 92 |
+
|
| 93 |
+
### C. Top-10 Feature Importances
|
| 94 |
+
Highlights which circuit features contribute most to distinguishing noise types.
|
| 95 |
+
Typical strong signals:
|
| 96 |
+
- `cx_count` / two-qubit gate counts
|
| 97 |
+
- Topology features (`adj_density`, `adj_degree_*`)
|
| 98 |
+
- `depth` and complexity metrics
|
| 99 |
+
|
| 100 |
+
---
|
| 101 |
+
|
| 102 |
+
## π 5. Metrics Explained
|
| 103 |
+
|
| 104 |
+
- **Accuracy** β Overall fraction of correctly classified circuits
|
| 105 |
+
- **Macro F1** β Average F1-score per class (treats all classes equally β sensitive to minority class `clean`)
|
| 106 |
+
- **Weighted F1** β F1-score weighted by class support
|
| 107 |
+
- **Per-class Precision / Recall / F1** β Detailed view, especially important for the underrepresented `clean` class
|
| 108 |
+
|
| 109 |
+
---
|
| 110 |
|
| 111 |
+
## π§ͺ 6. Experimentation Tips
|
| 112 |
|
| 113 |
+
Try the following to better understand the model:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
+
- **Focus on `clean` class** β select features carefully and observe how `class_weight="balanced"` helps
|
| 116 |
+
- Remove strong features (e.g. `cx_count`) β see performance drop
|
| 117 |
+
- Use only topology features β isolate structural effect
|
| 118 |
+
- Increase **Trees** (`max_iter`) to 300β500 for more stable predictions
|
| 119 |
+
- Adjust **Max depth** and **Test split** to check robustness
|
| 120 |
+
- Compare results with and without `class_weight`
|
| 121 |
|
| 122 |
---
|
| 123 |
|
| 124 |
+
## π¬ 7. Key Insight
|
| 125 |
|
| 126 |
+
> Noise type is not invisible β it leaves detectable fingerprints in circuit structure.
|
| 127 |
+
Even without expensive noisy simulation, features like gate counts, connectivity, and depth already contain enough signal to classify the underlying noise condition.
|
| 128 |
|
| 129 |
+
This demonstrates the power of **structure-aware** quantum machine learning.
|
|
|
|
|
|
|
| 130 |
|
| 131 |
---
|
| 132 |
|
| 133 |
+
## π 8. Project Resources
|
| 134 |
|
| 135 |
+
- π€ **Hugging Face**: [https://huggingface.co/QSBench](https://huggingface.co/QSBench)
|
| 136 |
+
- π» **GitHub**: [https://github.com/QSBench](https://github.com/QSBench)
|
| 137 |
+
- π **Website**: [https://qsbench.github.io](https://qsbench.github.io)
|