Fractional Boundary-Factored Neural Solver / fractional_dirichlet_track.py

✓✓ Beats tuned baseline

Raw ⬇ ZIP
 1import numpy as np
 2META = {'name':'fractional_dirichlet_boundary','domain':'pde','description':'Manufactured unit-disk fractional Dirichlet regression: target is distance-to-boundary^a times a smooth quotient, hence vanishes on the boundary.'}
 3A = 0.75
 4
 5def get_dataset(seed, n_train=400, n_test=400):
 6    rng = np.random.RandomState(seed)
 7    def sample(n):
 8        r = np.sqrt(rng.uniform(0.0, 1.0, n)).astype(np.float32)
 9        th = rng.uniform(0.0, 2*np.pi, n).astype(np.float32)
10        x = np.stack((r*np.cos(th), r*np.sin(th)), axis=1).astype(np.float32)
11        d = np.maximum(1.0-r, 0.0)
12        v = 1.0 + 0.35*np.sin(3*th) + 0.15*x[:,0]
13        y = (d**A*v).astype(np.float32)
14        return x, y
15    xtr,ytr = sample(n_train); xte,yte = sample(n_test)
16    return {'xtr':xtr,'ytr':ytr,'xte':xte,'yte':yte,'task':'regression','metric':'mse','out_dim':1,'input_shape':(2,)}