mirror of
https://github.com/wassname/moral-maps.git
synced 2026-09-09 11:27:22 +08:00
cleanup: assert on flat _zscore, doc the nll floor, trim history comments
_zscore now asserts nonzero variance (a flat profile drew a degenerate all-zero map that looked valid) instead of dividing by std+1e-9. _soft_nll docstring now states the 1e-12 floor it actually applies (was 'Unbounded'). Trim archaeology comments (guided/wvs/read_api) to the invariant, dropping the dated model names. Co-Authored-By: Claudypoo <288921227+claudypoo@users.noreply.github.com>
This commit is contained in:
@@ -232,8 +232,12 @@ def plot_ordinal(run_dir: Path, out: Path, name: str, vec_label: str, C: float,
|
||||
|
||||
def _zscore(v: np.ndarray) -> np.ndarray:
|
||||
"""Relative emphasis: centre and scale a profile across foundations, so a logit profile (model)
|
||||
and a 1-5 wrongness profile (human cultures) are comparable by PATTERN regardless of units."""
|
||||
return (v - v.mean()) / (v.std() + 1e-9)
|
||||
and a 1-5 wrongness profile (human cultures) are comparable by PATTERN regardless of units. A
|
||||
flat profile has no relative emphasis to show -- fail loud rather than divide by ~0 and draw a
|
||||
degenerate all-zero map that looks valid."""
|
||||
sd = v.std()
|
||||
assert sd > 0, "flat profile (zero variance across foundations): relative-emphasis map is undefined"
|
||||
return (v - v.mean()) / sd
|
||||
|
||||
|
||||
def read_human_mfv() -> tuple[list[str], dict[str, dict[str, float]]]:
|
||||
|
||||
Reference in New Issue
Block a user