QSBench commited on
Commit
0553f08
Β·
verified Β·
1 Parent(s): 94dd65f

Update GUIDE.md

Browse files
Files changed (1) hide show
  1. GUIDE.md +113 -41
GUIDE.md CHANGED
@@ -1,65 +1,137 @@
1
- You can explore datasets, visualize circuit QASM, and train a classical ML model to predict the noise type.
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  ---
4
 
5
- ## πŸ”Ž Explorer Tab
6
 
7
- The **Explorer** tab provides a preview of the dataset:
8
 
9
- 1. **Dataset Dropdown** – Select one of the datasets:
10
- - Core (Clean)
11
- - Depolarizing Noise
12
- - Amplitude Damping
13
- - Hardware-aware Noise
14
 
15
- 2. **Split Dropdown** – Select the data split (`train`, `test`, etc.).
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
- ## 🧠 Classification Tab
 
 
 
 
 
 
 
 
25
 
26
- The **Classification** tab allows you to train a Random Forest classifier on the selected features.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
- 1. **Input Features** – Select numeric features derived from the circuit:
29
- - Adjacency features (density, degree mean, etc.)
30
- - QASM features (length, gate counts, measure count, etc.)
31
 
32
- 2. **Test Split** – Fraction of data used for testing (default `0.2`).
33
- 3. **Trees (n_estimators)** – Number of trees in the Random Forest.
34
- 4. **Max Depth** – Maximum tree depth. Critical parameter; increasing it may cause runtime issues.
35
- 5. **Random Seed** – Seed for reproducibility.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
- Click **Train & Evaluate** to:
38
 
39
- - Fit the classifier
40
- - Compute metrics:
41
- - Accuracy
42
- - Macro F1
43
- - Weighted F1
44
- - Show confusion matrix
45
- - Show top 10 feature importances
46
 
47
- > ⚠️ Note: Max depth is the most influential hyperparameter. Setting it too high may crash the Space. Start with lower values.
 
 
 
 
 
48
 
49
  ---
50
 
51
- ## πŸ“Š Output
52
 
53
- After training, you will see:
 
54
 
55
- 1. **Confusion Matrix** – True vs predicted labels.
56
- 2. **Feature Importance** – Most relevant features for classification.
57
- 3. **Metrics** – Overall classification performance.
58
 
59
  ---
60
 
61
- ## πŸ”— Links
62
 
63
- - [QSBench Website](https://qsbench.github.io)
64
- - [Hugging Face Datasets](https://huggingface.co/QSBench)
65
- - [GitHub Repository](https://github.com/QSBench)
 
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)