File size: 3,435 Bytes
85ae166
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# 🌌 QSBench: Entanglement Score Regression Guide

Welcome to the **QSBench Regression Hub**.  
This tool demonstrates how Machine Learning can predict the **degree of quantum entanglement** — measured by the **Meyer–Wallach score** — using only circuit structure and topology.

---

## ⚠️ Important: Demo Dataset Notice

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

- **Limited size:** The dataset is intentionally reduced.
- **Impact:** Model performance may be unstable or noisy.
- **Goal:** Showcase how structural features correlate with entanglement — not achieve production-level accuracy.

---

## 🧠 1. What is Being Predicted?

The model predicts:

### `meyer_wallach`

A continuous entanglement measure:

- **0.0 → No entanglement**
- **1.0 → Maximum entanglement**

This metric captures how strongly qubits are globally correlated in a circuit.

---

## 🧩 2. How the Model “Sees” a Circuit

The model does **not simulate quantum states**.

Instead, it uses **structural proxies**:

### 🔹 Topology Features
- `adj_density` — how densely qubits interact  
- `adj_degree_mean` — average connectivity  
- `adj_degree_std` — variability in connectivity  

→ These reflect **entanglement potential** in the circuit graph.

---

### 🔹 Gate Structure
- `total_gates`
- `single_qubit_gates`
- `two_qubit_gates`
- `cx_count`

→ Two-qubit gates are the **primary drivers of entanglement**.

---

### 🔹 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 proxies for circuit complexity without parsing semantics.

---

## 🤖 3. Model Overview

The system uses:

### Random Forest Regressor

- Works well on tabular data  
- Handles non-linear relationships  
- Provides feature importance  

Pipeline includes:
- Missing value imputation  
- Feature scaling  
- Ensemble regression  

---

## 📊 4. Understanding the Results

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

---

### A. Actual vs Predicted

- Each point = one circuit  
- Diagonal line = perfect prediction  

→ The closer to the line → the better  

---

### B. Residual Distribution

- Shows prediction errors  
- Centered around 0 → good model  

→ Wide spread = uncertainty or weak features  

---

### C. Feature Importance

Top contributing features to prediction.

Typical patterns:
- `cx_count` → strong signal  
- `adj_density` → topology influence  
- `depth` → complexity contribution  

---

## 📉 5. Metrics Explained

- **RMSE** — penalizes large errors  
- **MAE** — average absolute error  
- **R²** — goodness of fit (1 = perfect)  

---

## 🧪 6. Experimentation Tips

Try:

- Removing `cx_count` → see how performance drops  
- Using only topology → isolate structural effect  
- Increasing trees → more stable predictions  
- Changing test split → robustness check  

---

## 🔬 7. Key Insight

> Entanglement is not random — it is encoded in circuit structure.

Even without simulation:
- Gate distribution  
- Connectivity  
- Depth  

…already contain enough signal to estimate entanglement.

---

## 🔗 8. Project Resources

- 🤗 Hugging Face: https://huggingface.co/QSBench  
- 💻 GitHub: https://github.com/QSBench  
- 🌐 Website: https://qsbench.github.io