# EMVal evaluation protocol Protocol version: `1.0.0`. EMVal evaluates models of time-harmonic electromagnetic behavior. `EMVal-NF` measures complex near-field predictions, and `EMVal-SP` measures complex S-parameter predictions. ## Evaluation subsets and aggregation EMVal separates in-distribution (ID) boards from out-of-distribution (OOD) boards by geometry family, where an ID board belongs to a design family that is included in model training, and an OOD board belongs to a design family that is excluded from model training. Regardless of whether a board geometry in our evaluation sets is ID or OOD, it is NOT included in the model training set. The `public` and `private_standard` groups are ID. The `private_challenge` group is OOD. Each metric is computed for one board. The dataset-level value is the equal-weight mean of the board values. Thus, a board with more ports or probes does not receive more weight. Near-field metrics pool all excited ports, frequencies, and probes within each board before the board-level reduction. ## Metrics ### EMVal-NF For a board excited at port \\(j\\) and frequency \\(f\\), let \\(\mathbf{F}_{jfp}\in\mathbb{C}^3\\) be the simulated field vector at probe \\(p\\), and let \\(\hat{\mathbf{F}}_{jfp}\\) be the prediction. Here, \\(\mathbf{F}\\) is either the electric field \\(\mathbf{E}\\) or the magnetic field \\(\mathbf{H}\\). The global relative \\(L_2\\) error compares total error energy with total simulated field energy across every excited port, frequency, and probe: $$ \operatorname{rel}L_2(\mathbf{F}) = \frac{\sqrt{\sum_{jfp}\lVert\hat{\mathbf{F}}_{jfp}-\mathbf{F}_{jfp}\rVert_2^2}}{\sqrt{\sum_{jfp}\lVert\mathbf{F}_{jfp}\rVert_2^2}}. $$ The scorer reports `rel_l2_E` and `rel_l2_H`. Because the metric sums squared absolute errors before normalization, it gives more weight to regions where the simulated field is strong. Lower values are better, and 0 is the optimum. The median local error normalizes the error at each probe by the simulated field magnitude and then takes the median: $$ \operatorname{local\text{-}q_{50}}(\mathbf{F}) = \operatorname{median}_{jfp}(e_{jfp}), \qquad e_{jfp} = \frac{\lVert\hat{\mathbf{F}}_{jfp}-\mathbf{F}_{jfp}\rVert_2}{\lVert\mathbf{F}_{jfp}\rVert_2}. $$ The scorer reports `local_q50_E` and `local_q50_H`. The local normalization gives low- and high-magnitude probes equal influence. The median limits the effect of a small number of large errors. Lower values are better, and 0 is the optimum. The median local alignment measures the alignment of the predicted and simulated complex vectors at each probe: $$ \operatorname{local\text{-}cos\text{-}q_{50}}(\mathbf{F}) = \operatorname{median}_{jfp}(c_{jfp}), \qquad c_{jfp} = \frac{\operatorname{Re}\!\left(\sum_{k=1}^{3}\hat F_{jfp,k}F_{jfp,k}^{*}\right)}{\lVert\hat{\mathbf{F}}_{jfp}\rVert_2\lVert\mathbf{F}_{jfp}\rVert_2}. $$ The scorer reports `local_cos_q50_E` and `local_cos_q50_H`. A value of 1 means that the prediction is aligned with the simulated vector in direction and complex phase. Higher values are better, and 1 is the optimum. The scorer also reports two field-average values. `rel_l2_avg` is the arithmetic mean of the dataset-level `rel_l2_E` and `rel_l2_H` values. `local_q50_avg` is the corresponding mean of `local_q50_E` and `local_q50_H`. ### EMVal-SP For one board, let \\(S_{ijf}\in\mathbb{C}\\) be the true S-parameter for receiving port \\(i\\), excited port \\(j\\), and frequency \\(f\\). Let \\(\hat S_{ijf}\\) be the prediction, and let \\(N\\) be the number of \\((i,j,f)\\) entries. The real-and-imaginary RMSE is $$ \operatorname{riRMSE} = \sqrt{\frac{1}{2N}\sum_{ijf}\left[\left(\operatorname{Re}(\hat S_{ijf}-S_{ijf})\right)^2+\left(\operatorname{Im}(\hat S_{ijf}-S_{ijf})\right)^2\right]}. $$ The scorer reports this value as `real_imag_rmse`. The factor \\(2N\\) treats the real and imaginary parts as separate dimensions. Lower values are better, and the mathematical optimum is 0. For the magnitude weighted-MAE, define \\(M=20\log_{10}|S|\\), \\(\hat M=20\log_{10}|\hat S|\\), and $$ w_{ijf} = \sigma\!\left(\frac{M_{ijf}-N_0}{\tau}\right), \qquad N_0=-20\ \mathrm{dB}, \qquad \tau=2\ \mathrm{dB}. $$ Then $$ \operatorname{mag\text{-}wMAE} = \frac{\sum_{ijf}w_{ijf}|\hat M_{ijf}-M_{ijf}|}{\sum_{ijf}w_{ijf}}. $$ The scorer reports this value as `mag_wmae` in dB. The sigmoid weight uses the simulated magnitude and reduces the contribution of deep nulls, where magnitude error in dB has limited engineering significance. Lower values are better, and 0 is the optimum. The phase weighted-MAE applies the same magnitude-derived weights to the shortest angular distance between the predicted and simulated phases: $$ \operatorname{phase\text{-}wMAE} = \frac{\sum_{ijf}w_{ijf}\left|\operatorname{wrap}_{[-\pi,\pi]}(\hat\phi_{ijf}-\phi_{ijf})\right|}{\sum_{ijf}w_{ijf}}. $$ The scorer reports this value as `ph_wmae` in radians. The magnitude weights prevent phase errors in deep nulls from dominating the metric. Lower values are better, and 0 is the optimum.