Measurement-Space Neural Operator with Mesh Transfer / custom_track.py

Mechanism confirmed, baseline not beaten

Raw ⬇ ZIP
 1import numpy as np
 2
 3META = {"name": "poisson_measurements", "domain": "pde", "description": "Synthetic Poisson-like elliptic field operator with irregular sensor/query meshes."}
 4
 5
 6def _fields(seed, n, m=16):
 7    rng = np.random.RandomState(seed)
 8    # Smooth forcing fields and a stable spectral inverse (Poisson surrogate).
 9    xx, yy = np.meshgrid(np.arange(m) / m, np.arange(m) / m, indexing="ij")
10    outx, outy = [], []
11    for _ in range(n):
12        f = np.zeros((m, m), np.float32)
13        for k in range(1, 4):
14            for l in range(1, 4):
15                a = rng.randn() / (k*k + l*l)
16                f += a * np.sin(2*np.pi*k*xx) * np.sin(2*np.pi*l*yy)
17        # Smooth elliptic solution, exactly generated in a low-frequency basis.
18        u = np.zeros_like(f)
19        for k in range(1, 4):
20            for l in range(1, 4):
21                # recover coefficients by projection (basis is orthogonal on grid)
22                basis = np.sin(2*np.pi*k*xx) * np.sin(2*np.pi*l*yy)
23                c = float((f*basis).mean()) / max(float((basis*basis).mean()), 1e-8)
24                u += c / (k*k+l*l) * basis
25        outx.append(f.reshape(-1)); outy.append(u.reshape(-1))
26    return np.asarray(outx, np.float32), np.asarray(outy, np.float32)
27
28
29def get_dataset(seed, n_train, n_test):
30    xtr, ytr = _fields(seed + 17, n_train)
31    xte, yte = _fields(seed + 991, n_test)
32    return {"xtr": xtr, "ytr": ytr, "xte": xte, "yte": yte,
33            "task": "regression", "metric": "mse", "input_shape": (256,), "out_dim": 256}