FMM-Accelerated Polyharmonic Neural Field Head / custom_spatial.py
Beats tuned baseline
1import numpy as np
2
3META = {
4 'name': 'spatial_anchor_regression',
5 'domain': 'spatial neural field / interpolation',
6 'description': '2D coordinate regression with smooth and localized spatial structure for anchor-kernel neural-field heads.'
7}
8
9def get_dataset(seed, n_train, n_test):
10 def sample(n, rs):
11 x = rs.uniform(-1.0, 1.0, size=(n, 2)).astype(np.float32)
12 y = (np.sin(3*x[:, 0])*np.cos(2*x[:, 1])
13 + 0.35*np.exp(-18*((x[:, 0]-.35)**2+(x[:, 1]+.25)**2))
14 + .08*x[:, 0] - .04*x[:, 1]).astype(np.float32)
15 return x, y[:, None]
16 xtr, ytr = sample(n_train, np.random.RandomState(seed))
17 xte, yte = sample(n_test, np.random.RandomState(seed+5000))
18 return {'xtr': xtr, 'ytr': ytr, 'xte': xte, 'yte': yte,
19 'task': 'regression', 'metric': 'mse', 'out_dim': 1}