Efradeca commited on
Commit
237a3b2
·
verified ·
1 Parent(s): 9969798

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -129,9 +129,11 @@ equilibrium-regularized model outputs three stress-tensor channels and derives v
129
  ### Results
130
 
131
  Geo-FNO Elasticity test relative L2. We report **median** (robust to the high run-to-run variance of
132
- this 1000-sample benchmark) alongside mean ± std and the seed count; full per-seed distributions are in
133
- the repository (`results/study_summary.json`). All "this work" rows use identical training under one
134
- method (`torch.compile`); the baseline reproduces the published 0.0064 on its good seeds.
 
 
135
 
136
  | Model | median | mean ± std | n | params |
137
  |---|---|---|---|---|
 
129
  ### Results
130
 
131
  Geo-FNO Elasticity test relative L2. We report **median** (robust to the high run-to-run variance of
132
+ this 1000-sample benchmark) alongside mean ± std and the seed count; full committed per-seed
133
+ distributions are in the repository (`docs/RESULTS.md`, `results/study_summary.json`). The
134
+ accuracy-comparison rows (baseline, LinearNO M=64/M=256) use `torch.compile`; the
135
+ equilibrium-regularized row is eager (`compile:false`). The baseline reproduces the published 0.0064
136
+ on its good seeds.
137
 
138
  | Model | median | mean ± std | n | params |
139
  |---|---|---|---|---|
__pycache__/model.cpython-312.pyc ADDED
Binary file (4.57 kB). View file
 
model.py CHANGED
@@ -76,5 +76,7 @@ def predict_stress(model, coords: np.ndarray, norm, info, device: str = "cpu") -
76
  S = info["scale_S"] or 1.0
77
  stress = von_mises(out) * S # 3-channel tensor -> von Mises, undo target scale
78
  else:
79
- stress = out[:, 0] * std + mean # de-normalize scalar prediction
80
- return stress.detach().cpu().numpy()
 
 
 
76
  S = info["scale_S"] or 1.0
77
  stress = von_mises(out) * S # 3-channel tensor -> von Mises, undo target scale
78
  else:
79
+ # de-normalize scalar prediction; reshape so the broadcast of a (1,1[,1]) normalizer
80
+ # against out[:,0] (N,) cannot leak a leading axis (audit bug 1). Always returns (N,).
81
+ stress = (out[:, 0] * std.reshape(()) + mean.reshape(()))
82
+ return stress.reshape(-1).detach().cpu().numpy()
stress_operator/data/ood_split.py CHANGED
@@ -59,6 +59,15 @@ def make_ood_split(
59
 
60
  in_dist = np.where(stat <= threshold)[0]
61
  ood = np.where(stat > threshold)[0]
 
 
 
 
 
 
 
 
 
62
 
63
  rng = np.random.default_rng(seed)
64
  perm = rng.permutation(in_dist)
@@ -73,7 +82,7 @@ def make_ood_split(
73
  "n_ood_test": int(ood.size),
74
  "threshold": threshold,
75
  "stat_kind": stat_kind,
76
- "stat_train_max": float(stat[train_idx].max()),
77
  "stat_ood_min": float(stat[ood].min()),
78
  "stat_ood_max": float(stat[ood].max()),
79
  }
 
59
 
60
  in_dist = np.where(stat <= threshold)[0]
61
  ood = np.where(stat > threshold)[0]
62
+ # A strict `> quantile` split yields an empty OOD group if the stat ties at its max
63
+ # (degenerate distribution). Guard so `.min()/.max()` below cannot crash (audit bug 2);
64
+ # real continuous `rr` data is non-degenerate (n_ood ~ 400 at train_frac=0.8).
65
+ if ood.size == 0:
66
+ raise ValueError(
67
+ f"OOD split is empty: stat ({stat_kind}) has no values above the "
68
+ f"{train_frac:.0%} quantile (likely tied at the maximum). Lower train_frac "
69
+ f"or choose a different stat."
70
+ )
71
 
72
  rng = np.random.default_rng(seed)
73
  perm = rng.permutation(in_dist)
 
82
  "n_ood_test": int(ood.size),
83
  "threshold": threshold,
84
  "stat_kind": stat_kind,
85
+ "stat_train_max": float(stat[train_idx].max()) if train_idx.size else float("nan"),
86
  "stat_ood_min": float(stat[ood].min()),
87
  "stat_ood_max": float(stat[ood].max()),
88
  }