Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

A first surrogate: learn, design, and verify

Chapter 10 analytical starter. This notebook uses a synthetic resonant-sheet formula, not a full-wave simulation or measured dataset. The scalar design coordinate has no assigned fabrication geometry. The purpose is to make the data split, learning calculation, inverse search, and verification inspectable.

Read the chapter and lab instructions. Restart the kernel and run all cells. Edit the parameters below to repeat the experiment. No network access, GPU, or external data is required during execution.

1. Environment and editable parameters

All frequencies and linewidths below are normalized by a reference angular frequency. The design coordinate is dimensionless.

Python 3.12.1, NumPy 2.4.6, Matplotlib 3.11.1
Evidence: analytical synthetic model; no full-wave or experimental validation.

2. Define and check the forward generator

For the e−iωte^{-i\omega t} convention and a symmetric lossless two-port model in equal media,

r=−γγ−iΔ,t=1+r,Δ=Ω−Ω0.r=-\frac{\gamma}{\gamma-i\Delta},\qquad t=1+r,\qquad\Delta=\Omega-\Omega_0.

The design mapping is Ω0=0.9+0.2g\Omega_0=0.9+0.2g and γ=0.025+0.02g\gamma=0.025+0.02g. These choices are teaching assumptions. Both R+T=1R+T=1 and the resonance values can be checked independently from the algebra.

Maximum analytical power-balance residual: 5.551e-16
Resonance check passed: r = -1 and t = 0.

3. Split whole designs

Each row contains a complete complex spectrum. We split geometry IDs, so frequencies belonging to one design cannot leak across sets. The validation set chooses model settings. The test set remains unused until the model choice is fixed. This experiment tests interpolation within the sampled design interval, not out-of-domain generalization.

Training IDs: [0, 6, 7, 8, 11, 17, 22, 23, 25, 29, 31, 32, 33, 35, 36, 37, 38, 41, 42, 45, 49, 52, 53, 54, 56, 57, 58, 59, 61, 62, 63, 65, 66, 67, 68, 73, 75, 76, 77, 78]
Validation IDs: [1, 2, 4, 10, 13, 16, 20, 21, 30, 34, 40, 43, 44, 46, 48, 50, 51, 69, 74, 79]
Test IDs: [3, 5, 9, 12, 14, 15, 18, 19, 24, 26, 27, 28, 39, 47, 55, 60, 64, 70, 71, 72]

4. Fit a baseline and a kernel surrogate

Nearest-neighbor retrieval returns the entire spectrum of the closest training design. Kernel ridge regression uses

Kij=exp⁡[−(gi−gj)2/(2ℓ2)],(K+αI)A=Y.K_{ij}=\exp[-(g_i-g_j)^2/(2\ell^2)],\quad (K+\alpha I)A=Y.

We solve this system for complex spectral columns. There is no test-set preprocessing or tuning. The implementation uses only NumPy so that every operation can be inspected.

Validation selected length scale=0.12, alpha=1e-08
Validation complex RMSE=0.000643005

5. Evaluate held-out designs

The complex RMSE is dimensionless. The power error below refers to absolute transmission fractions, not a relative percentage error. Because the generator obeys r = t - 1, we can diagnose power imbalance after reconstructing reflection from a predicted transmission. That reconstruction does not make the regression automatically lossless.

Nearest neighbor  complex RMSE=0.0413522; power MAE=0.0163445; max balance residual=4.44089e-16
Kernel ridge      complex RMSE=0.000353376; power MAE=7.65072e-05; max balance residual=0.00913201
Phase example: ordinary difference = -358 degrees; circular difference = 2.0 degrees

6. Propose an inverse design, then verify it

The target comes from a known feasible design, but its coordinate is used only to generate the target and later interpret the result. The search minimizes mean squared complex transmission error over a bounded grid using the surrogate. We then call the exact analytical generator at the selected design.

Agreement with this generator checks surrogate error. It does not establish a physical realization, full-wave accuracy, or global optimality in a continuous design space.

Target generator coordinate: 0.623000
Selected coordinate: 0.623000; grid spacing: 0.001000
Surrogate target RMSE: 3.2859e-05
Analytically verified target RMSE: 0

7. Inspect the evidence

Inspect both spectral shape and error distributions. If the inverse curves nearly coincide, use the numerical errors printed above rather than interpreting line overlap as exact equality. This one-dimensional synthetic problem is intentionally small; it is not a performance benchmark for a high-dimensional metasurface design.

<Figure size 1200x800 with 5 Axes>

8. Extensions and report

  1. Reduce the training count and repeat the complete split/selection/test procedure. Compare learning curves across several seeds.

  2. Replace the random geometry split with a deliberately withheld interval. Label this result separately from the interpolation test.

  3. Remove part of the resonance band from the measured outputs. Discuss whether the inverse target remains identifiable.

  4. Examine circular phase errors only above a declared amplitude threshold, and also report amplitude error and the excluded fraction.

  5. Add numerical or measurement noise with a documented model. Repeat selection of the regularization parameter.

  6. Replace this generator with a converged full-wave unit-cell dataset as described in Stage B of the lab. Preserve geometry IDs, normalization, solver settings, and reference planes.

Report the split IDs, environment, seed, hyperparameters, test errors, candidate bounds/grid spacing, and predicted-versus-verified target errors. Explain the limits of each claim. The learning calculation does not run in the static web page; download the notebook to modify and execute it.