Icosahedral Congruence-Robust Strain Sensor / custom_strain_track.py
Mechanism confirmed, baseline not beaten
1import numpy as np
2
3META = {"name": "strain_congruence", "domain": "dynamics", "description": "Volume-preserving 3D deformation with six directional strain channels; predict a nonlinear strain-dynamics target."}
4
5
6def get_dataset(seed, n_train, n_test):
7 def make(n, s):
8 rng = np.random.RandomState(s)
9 X = np.empty((n, 15), np.float32)
10 Y = np.empty((n, 1), np.float32)
11 phi = (1 + np.sqrt(5.0)) / 2
12 axes = np.array([(0,1,phi),(1,phi,0),(phi,0,1),(0,1,-phi),(1,-phi,0),(phi,0,-1)], np.float32) / np.sqrt(1+phi*phi)
13 for i in range(n):
14 H = rng.normal(0, .65, (3,3)).astype(np.float64)
15 H -= np.trace(H) * np.eye(3) / 3
16 # diagonal positive SL(3) deformation, preserving the stated structure
17 F = np.diag(np.exp(np.diag(H)))
18 S = rng.normal(0, .7, (3,3)); S = (S+S.T)/2
19 S -= np.trace(S)*np.eye(3)/3
20 w = axes @ F.T
21 y = np.einsum('ni,ij,nj->n', w, S, w)
22 # target is a task-independent nonlinear dynamics quantity
23 target = (np.tanh(S[0,1] + .35*S[1,2]) + .25*np.sin(np.linalg.norm(F-np.eye(3))) + .1*S[0,0]*S[1,1])
24 X[i] = np.r_[F.reshape(-1), y]
25 Y[i,0] = target
26 return X, Y
27 xtr,ytr=make(n_train,seed); xte,yte=make(n_test,seed+5000)
28 return {"xtr":xtr,"ytr":ytr,"xte":xte,"yte":yte,"task":"regression","metric":"mse","out_dim":1}