import numpy as np META = { 'name': 'spatial_anchor_regression', 'domain': 'spatial neural field / interpolation', 'description': '2D coordinate regression with smooth and localized spatial structure for anchor-kernel neural-field heads.' } def get_dataset(seed, n_train, n_test): def sample(n, rs): x = rs.uniform(-1.0, 1.0, size=(n, 2)).astype(np.float32) y = (np.sin(3*x[:, 0])*np.cos(2*x[:, 1]) + 0.35*np.exp(-18*((x[:, 0]-.35)**2+(x[:, 1]+.25)**2)) + .08*x[:, 0] - .04*x[:, 1]).astype(np.float32) return x, y[:, None] xtr, ytr = sample(n_train, np.random.RandomState(seed)) xte, yte = sample(n_test, np.random.RandomState(seed+5000)) return {'xtr': xtr, 'ytr': ytr, 'xte': xte, 'yte': yte, 'task': 'regression', 'metric': 'mse', 'out_dim': 1}