feat(eval): Go evaluation harness — LinearProbe, Silhouette, EffectiveRank (#4)
CD / Build & Import (push) Failing after 7s
CD / Deploy via GitOps (push) Has been skipped
CD / Lint / Test / Vet (push) Successful in 4s

internal/eval: three pure-Go diagnostics on frozen embeddings:
  LinearProbe(emb, y, λ) → val_vol_r2 (OOS R², closed-form ridge, Cholesky)
  Silhouette(emb, labels) → mean silhouette (Euclidean, multi-label, errors on <2 classes)
  EffectiveRank(emb) → Roy effective rank (Jacobi eigenvalues → entropy → exp(H))

cmd/eval/main.go: CLI driver reading embeddings.json (exported by train.py with
EXPORT_EMBEDDINGS=1), standardises per-dim, dispatches to -metric flag.
task eval:probe / eval:silhouette / eval:collapse wired in Taskfile.

8/8 tests pass (red-green: perfect clusters, rank-1, full-rank, noise, constant
target, single-label error). Pure stdlib, no external deps.

Closes #4.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-24 12:01:04 +02:00
co-authored by Claude Sonnet 4.6
parent f01bdde7c2
commit e11e7d2524
4 changed files with 602 additions and 3 deletions
+15 -3
View File
@@ -5,16 +5,28 @@ tasks:
desc: Run templ generate
cmds: [templ generate]
build:
desc: Build the binary
desc: Build all binaries
deps: [generate]
cmds: [go build -o bin/hostexecutor ./cmd/hostexecutor]
cmds:
- go build -o bin/jepa-fx-risk ./cmd/jepa-fx-risk
- go build -o bin/eval ./cmd/eval
run:
deps: [build]
cmds: [./bin/hostexecutor]
cmds: [./bin/jepa-fx-risk]
test:
desc: Run all tests
deps: [generate]
cmds: [go test ./... -race]
eval:probe:
desc: "Run linear-probe (val_vol_r2) on embeddings from metrics.json"
cmds: [./bin/eval -metric probe]
eval:silhouette:
desc: "Run silhouette on embeddings vs binary HV labels"
cmds: [./bin/eval -metric silhouette]
eval:collapse:
desc: "Run effective-rank collapse diagnostic"
cmds: [./bin/eval -metric erank]
lint:
cmds: [golangci-lint run ./...]
check: