march2022_level0 / README.md
LiangXD's picture
Upload README.md with huggingface_hub
93decce verified
|
Raw
History Blame Contribute Delete
7.87 kB
---
license: other
task_categories:
- other
tags:
- power-electronics
- pytorch-geometric
- graph-neural-networks
- dcdc-converter
- march2022
language:
- en
size_categories:
- 1M<n<10M
---
# march2022_level0 — PyG power-electronics graphs (Level-0 parent corpus)
Variable-length [PyTorch Geometric](https://pytorch-geometric.readthedocs.io) `Data` graphs built from the **March 2022 Level-0** raw dump (`data/March2022 Raw/`). Each row pairs a fixed netlist topology with one sweep design and **pre-computed** `metric_data` — **no ngSpice**, no `.raw` waveforms.
This is the **parent corpus** audited in `notebooks/march2022/verify_march2022_dataset.ipynb`. Downstream Level-2 datasets in this repo re-simulate **one topology family** with ngSpice and attach waveforms.
**Build notebook:** `notebooks/march2022/build_march2022_pyg_dataset.ipynb`
**Hub:** `LiangXD/march2022_level0`
## Metric provenance
Only **`metric_success`** applies here (finite `DcGain` **and** finite `Voltage_Ripple` from `metric_data`). This matches **Branch B** of the repo’s `simulation_success` tree — without Branch A (waveforms) or ngSpice infrastructure legs.
![Level-0 metric success tree](level0_metric_success_tree.png)
[Vector PDF](level0_metric_success_tree.pdf) · [metric_success.md](metric_success.md)
### Build summary (notebook §7)
Counts below follow the tree above (`metric_success = 0` categories map to failure leaves).
| split | graphs | build wall time |
|-------|-------:|----------------:|
| `train` | 1,208,102 | 2h 27m 33s |
| `val` | 345,171 | 40m 20s |
| `test` | 172,587 | 20m 46s |
| **overall** | **1,725,860** | **3h 29m 25s** |
**`metric_success` tally**
| | count |
|---|---:|
| `metric_success = 1` | 1,021,987 |
| `metric_success = 0` | 703,873 |
| **check** | **1,725,860** |
**`metric_success = 0` categories**
| category | count |
|----------|------:|
| `nan_gain` | 599,458 |
| `zero_gain_nan_ripple` | 99,645 |
| `positive_gain_nan_ripple` | 4,770 |
**`large_ripple = 1`:** 3,999 (per-split indices in `graphs/large_ripple.json`).
## Build reference (Windows, Jul 2026)
| item | value |
|---|---|
| Platform | Windows 10, Python 3.9.6, PyTorch 2.1.1, PyG 2.6.1 |
| RAM | 32 GB (+ pagefile 16–48 GB on C: during `train.pt` save) |
| Wall time | **3h 29m** (train 2h 28m · val 40m · test 21m) |
| On-disk size | **~10.4 GB** total (`train` 7.33 · `val` 2.05 · `test` 1.03 GB) |
| Raw parent dump | `<2 GB` tabular (`sweep_table.csv` + `metric_data` per folder) |
Metrics-only graphs (no waveforms) — on-disk `.pt` size is much smaller than in-RAM peak (~31 GB during pickle) thanks to compact tensors and pickle memoization (e.g. shared `color_map`).
### Verification (build notebook)
| Stage | Check |
|-------|--------|
| **7b (pre-upload)** | Semantic: spot-check `test.pt` vs raw `sweep_table.csv` + `metric_data` |
| **8b (post-upload)** | Integrity: local `test.pt` SHA256 vs Hub `graphs/test.pt` SHA256 |
## Corpus scale (index pass)
| item | count |
|---|---:|
| `CircuitN` folders | ~4,607 |
| distinct `iso_topo_hash` | ~1,538 |
| **used sweep rows** | **~1,725,860** |
Used rows = `min(n_sweep_rows, n_metric_rows)` per folder (drops trailing zero-padding in `metric_data`).
## Variable-length graphs
Unlike single-topology Level-2 datasets, **`num_nodes`**, **`initial_design`**, and **`switching_parameters`** lengths depend on the `family` field (`S_D_L_C_N`).
### Canonical `initial_design` layout
Parse `family` as `n_S, n_D, n_L, n_C, n_N` (use the first four):
```
initial_design[0 : n_C] → C0 … C{n_C-1} capacitances (F)
initial_design[n_C : n_C+n_L] → L0 … L{n_L-1} inductances (H)
initial_design[n_C+n_L] → shared T1 (from GS0_T1 in sweep_table; stored as-is)
initial_design[n_C+n_L+1 : +n_S] → GS0_L1 … GS{n_S-1}_L1
initial_design[…+n_S : +n_S] → GS0_L2 … GS{n_S-1}_L2
```
Length = `n_C + n_L + 1 + 2×n_S`.
**T1 / duty units:** `GS#_T1` values are stored **as-is** from `sweep_table.csv` (no rescaling). They **look like normalized duty ratios** (~0–1), not absolute switch-on times in seconds. We have **not** verified whether the implied switching period matches Level-2’s `5 µs` base (`GS{i}_T1 = duty × 5e-6` s in rewritten netlists). That ambiguity does **not** affect comparability **within** this dataset: every March 2022 sample was generated under the **same** underlying sweep convention.
Empirical scan (first sweep row per folder, `GS0_T1`; all `GS#_T1` identical per row in **4,607 / 4,607** folders):
| Stat | Value |
|------|------:|
| min / median / max (`GS0_T1`) | 0.000178 / 0.503 / 0.990 |
| folders with `GS0_T1` ∈ [0.1, 0.9] | 4,570 |
| folders with `GS0_T1` < 1e-4 (seconds-like) | 0 |
| folders with `GS0_T1` outside [0.05, 1.0] | 11 |
On each `Data` graph, the shared duty appears as `initial_design[n_C+n_L]`, `switching_parameters[0]`, and `input_feature[S#][0]` — not a separate `T1_shared` field.
### `node_name` ↔ `edge_index` ↔ `initial_design`
`node_name[i]` is the string label for integer node `i` in `edge_index`. Component values align by **designator suffix**, not list position:
```python
k = int("C0"[1:]) # → 0
c0_design = g.initial_design[k]
c0_feat = g.input_feature[g.node_name.index("C0")][0]
# c0_design == c0_feat
```
`switching_parameters` has length `1 + 2×n_S`: `[T1_duty, GS0_L1…, GS0_L2…]` (`switching_parameters[0]` = shared duty).
### WL hashes (provenance)
| field | definition |
|---|---|
| `iso_topo_hash` | `networkx.weisfeiler_lehman_graph_hash` on connectivity graph; switch nodes labeled `S` |
| `sw_topo_hash` | same, but switches relabeled `S_{L1}{L2}` from the sweep row before hashing |
Same definitions as `notebooks/march2022/verify_march2022_dataset.ipynb` (state-augmented WL for switch assignment).
## Fields on each `Data`
**Present:** `edge_index`, `num_nodes`, `node_type`, `node_name`, `bipartite`, `input_feature`, `initial_design`, `switching_parameters`, `DcGain`, `Voltage_Ripple`, `metric_success`, `zero_dc_gain`, `large_ripple`, `split`, `sample_index`, `folder_key`, `family`, `group`, `iso_topo_hash`, `sw_topo_hash`, `color_map`.
**Absent (no ngSpice / no waveforms):** `V_sw`, `I_sw`, `V_r0_full`, `ngspice_run_success`, `waveform_success`, `simulation_success`, `sw_pre_n`, `sw_post_n`, `rewrite_netlist_str`, `raw_file`.
## Splits
Global shuffle (`SHUFFLE_SEED=523`), then **7:2:1** train/val/test (same ratio as `dataset_configs/sampling.py`).
| split | graphs |
|---|---:|
| `train` | 1,208,102 |
| `val` | 345,171 |
| `test` | 172,587 |
| **total** | **1,725,860** |
Build wall times and full `metric_success` / `large_ripple` tallies: see **Build summary** under Metric provenance.
## Repository layout (Hub)
```
graphs/
├── train.pt
├── val.pt
├── test.pt
└── large_ripple.json
level0_metric_success_tree.png
level0_metric_success_tree.pdf
metric_success.md
README.md
```
## Load example
```python
import torch
graphs = torch.load("artifacts/march2022_level0/graphs/train.pt", weights_only=False)
g = graphs[0]
print(g.family, g.folder_key, g.num_nodes)
print(int(g.metric_success), float(g.DcGain), float(g.Voltage_Ripple))
print(g.initial_design.shape, g.switching_parameters.shape)
# name → index
i = g.node_name.index("C0")
print(g.node_name[i], g.input_feature[i])
```
## Training with PyG
Graphs are **undirected**; `edge_index` stores both orientations. Use `data.edge_index` as-is in PyG layers.
Because graphs vary in size, use a **custom collate** or batch size 1 unless you pad `initial_design` / node features explicitly.