File size: 4,497 Bytes
0553f08
 
 
 
 
 
 
 
 
 
 
 
 
 
7bc7a81
 
 
0553f08
7bc7a81
0553f08
7bc7a81
0553f08
 
 
 
 
7bc7a81
0553f08
7bc7a81
 
 
0553f08
 
 
 
 
 
 
 
 
7bc7a81
0553f08
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7bc7a81
0553f08
7bc7a81
0553f08
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7bc7a81
0553f08
7bc7a81
0553f08
7bc7a81
0553f08
 
 
 
 
 
7bc7a81
 
 
0553f08
7bc7a81
0553f08
 
7bc7a81
0553f08
7bc7a81
 
 
0553f08
7bc7a81
0553f08
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# 🌌 QSBench: Noise Classification Guide

Welcome to the **QSBench Noise Classification Hub**.  
This tool demonstrates how Machine Learning can distinguish different **noise conditions** in quantum circuits using only structural and topological features β€” without running expensive simulations.

---

## ⚠️ Important: Demo Dataset Notice

This Space uses **demo shards** of the QSBench datasets.

- **Limited size**: The dataset is intentionally reduced for fast loading and demonstration.
- **Impact**: Model performance may be unstable or noisy, especially on the minority class.
- **Goal**: Showcase how circuit structure correlates with noise type β€” not achieve production-level accuracy.

---

## 🧠 1. What is Being Predicted?

The model performs **multi-class classification** into four noise conditions:

### Classes
- **`clean`** β€” Ideal circuit without noise  
- **`depolarizing`** β€” Uniform depolarizing noise  
- **`amplitude_damping`** β€” Energy relaxation / amplitude damping  
- **`hardware_aware`** β€” Realistic hardware-aware noise after transpilation  

The task is to predict the **noise_label** from circuit features only.

---

## 🧩 2. How the Model β€œSees” a Circuit

The model does **not** simulate quantum states or noise channels.  
Instead, it relies on **structural proxies**:

### πŸ”Ή Topology Features
- `adj_density` β€” How densely qubits are connected  
- `adj_degree_mean` β€” Average qubit connectivity  
- `adj_degree_std` β€” Variability in connectivity  

β†’ These reflect the **interaction graph** and entanglement potential.

### πŸ”Ή Gate Structure
- `total_gates`
- `single_qubit_gates`
- `two_qubit_gates`
- `cx_count` (or similar two-qubit counts)

β†’ Two-qubit gates strongly influence noise sensitivity.

### πŸ”Ή Complexity Metrics
- `depth`
- `gate_entropy`

β†’ Capture how β€œdeep” and β€œstructured” the circuit is.

### πŸ”Ή QASM-derived Signals
- `qasm_length`
- `qasm_line_count`
- `qasm_gate_keyword_count`

β†’ Lightweight text-based proxies for circuit complexity.

---

## πŸ€– 3. Model Overview

The system uses:

### HistGradientBoostingClassifier
- Fast and accurate gradient boosting on tabular data
- Handles non-linear relationships well
- Supports `class_weight="balanced"` to deal with class imbalance

**Pipeline includes:**
- Median imputation for missing values
- Standard scaling
- Gradient boosting classifier

---

## πŸ“Š 4. Understanding the Results

After clicking **"Train & Evaluate"**, you get:

### A. Confusion Matrix
Shows how often each true noise type is predicted correctly or confused with others.

### B. Correct vs Incorrect
Simple histogram of prediction accuracy.

### C. Top-10 Feature Importances
Highlights which circuit features contribute most to distinguishing noise types.  
Typical strong signals:
- `cx_count` / two-qubit gate counts
- Topology features (`adj_density`, `adj_degree_*`)
- `depth` and complexity metrics

---

## πŸ“‰ 5. Metrics Explained

- **Accuracy** β€” Overall fraction of correctly classified circuits
- **Macro F1** β€” Average F1-score per class (treats all classes equally β€” sensitive to minority class `clean`)
- **Weighted F1** β€” F1-score weighted by class support
- **Per-class Precision / Recall / F1** β€” Detailed view, especially important for the underrepresented `clean` class

---

## πŸ§ͺ 6. Experimentation Tips

Try the following to better understand the model:

- **Focus on `clean` class** β€” select features carefully and observe how `class_weight="balanced"` helps
- Remove strong features (e.g. `cx_count`) β†’ see performance drop
- Use only topology features β†’ isolate structural effect
- Increase **Trees** (`max_iter`) to 300–500 for more stable predictions
- Adjust **Max depth** and **Test split** to check robustness
- Compare results with and without `class_weight`

---

## πŸ”¬ 7. Key Insight

> Noise type is not invisible β€” it leaves detectable fingerprints in circuit structure.  
Even without expensive noisy simulation, features like gate counts, connectivity, and depth already contain enough signal to classify the underlying noise condition.

This demonstrates the power of **structure-aware** quantum machine learning.

---

## πŸ”— 8. Project Resources

- πŸ€— **Hugging Face**: [https://huggingface.co/QSBench](https://huggingface.co/QSBench)
- πŸ’» **GitHub**: [https://github.com/QSBench](https://github.com/QSBench)
- 🌐 **Website**: [https://qsbench.github.io](https://qsbench.github.io)