Laplacian-Coherence Graph Minibatches / graph_track.py

✓✓ Beats tuned baseline

Raw ⬇ ZIP
 1import numpy as np
 2
 3META = {
 4    'name': 'laplacian_coherence_graph',
 5    'domain': 'graph-nn',
 6    'description': 'Synthetic weakly coupled two-community graph node classification.'
 7}
 8
 9def get_dataset(seed, n_train, n_test):
10    rng = np.random.default_rng(seed)
11    n = n_train + n_test
12    y = (np.arange(n) >= n // 2).astype(np.int64)
13    x = rng.normal(0, .7, (n, 8)).astype(np.float32)
14    s = 2*y - 1
15    x[:, 0] = .18*s
16    x[:, 1] = .12*s
17    flip = rng.random(n) < .12
18    y[flip] = 1 - y[flip]
19    return {'xtr': x[:n_train], 'ytr': y[:n_train],
20            'xte': x[n_train:], 'yte': y[n_train:],
21            'task': 'classification', 'metric': 'err', 'out_dim': 2}