ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Janady13/missionmatch / internal/platform/learn/metrics_test.go

Source identity, revision, and recovered contents.

GitHub sourceSource text recovered

Source identity

FieldRecorded value
Source typeGitHub source
Original recordJanady13/missionmatch / internal/platform/learn/metrics_test.go
DateNot specified in source
RepositoryJanady13/missionmatch
Revision720d47fae476b0d38477ae4401697d372b1ea2bc
Branchfeature/opportunity-to-outcome
Path or archive memberinternal/platform/learn/metrics_test.go
Original SHA-256e51d179a12bfaf7b5728c9fefc3463599ed6b42e898662113193683a2cd9312f
Git blob SHA26ba2d87a3bda2bd360eccc9ed443f5f04810ef5
Reading-copy SHA-256e51d179a12bfaf7b5728c9fefc3463599ed6b42e898662113193683a2cd9312f

Original source ↗

Every recorded occurrence

These 10 records contain identical original source bytes. Their paths and revisions remain part of the archive.

Original recordBranch or archiveRevision / identifierOriginal location
Janady13/missionmatch / internal/platform/learn/metrics_test.gofeature/opportunity-to-outcome720d47fae476b0d38477ae4401697d372b1ea2bcOpen original
Janady13/missionmatch / internal/platform/learn/metrics_test.gocollision-deconfliction4ee5a09972608ed89f8377c6665542d5f450f0a6Open original
Janady13/missionmatch / internal/platform/learn/metrics_test.gomaster1e9249840a4302ec82e123b9c9cb6f75badea3e4Open original
Janady13/missionmatch / internal/platform/learn/metrics_test.gomag-substrateb82c7100a492dec67dfd1eda6b3f53def859be35Open original
Janady13/missionmatch / internal/platform/learn/metrics_test.gotime-to-fill-survivalb66e1e505863d4f17741a4b9ede73509e45bd6c6Open original
Janady13/missionmatch / internal/platform/learn/metrics_test.gopresentation-readinesseb574acaa29d71ce4d0f852572e87c275c79fdb7Open original
Janady13/missionmatch / internal/platform/learn/metrics_test.govendor-intelligencefe9796a19c261951d3f2565206c0c1b5ac294465Open original
Janady13/missionmatch / internal/platform/learn/metrics_test.gophase2-connectorse038d4c687aec16f8bd9bc4d907eea14d91f8704Open original
Janady13/missionmatch / internal/platform/learn/metrics_test.gofeature/aioe-upgrade2178e7298d0e5d9af83afa12402fd587f0ba6ed8Open original
Janady13/missionmatch / internal/platform/learn/metrics_test.gocapture-readinessbae6af7cb2997e819174a9e9cfff5e16067a1975Open original

Recovered source transcript

package learn import ( "math" "testing" ) func TestECEZeroOnPerfectCalibration(t *testing.T) { // every prediction sits at 0 or 1 and the label agrees, so every bin's mean predicted equals its // empirical rate and the calibration error is exactly zero. probs := []float64{0, 0, 1, 1, 0, 1} y := []int{0, 0, 1, 1, 0, 1} if e := ECE(probs, y, 10); e != 0 { t.Fatalf("a perfectly calibrated set must have ECE 0, got %v", e) } } func TestECEPositiveOnMiscalibration(t *testing.T) { // every prediction claims 0.9 but the outcomes are all 0, so the gap is 0.9 in the one occupied bin. probs := []float64{0.9, 0.9, 0.9, 0.9} y := []int{0, 0, 0, 0} e := ECE(probs, y, 10) if math.Abs(e-0.9) > 1e-9 { t.Fatalf("a set that predicts 0.9 for all zero outcomes must have ECE 0.9, got %v", e) } } func TestECEEmptyIsZero(t *testing.T) { if e := ECE(nil, nil, 10); e != 0 { t.Fatalf("an empty set must have ECE 0, got %v", e) } } func TestAUCPerfectRanking(t *testing.T) { // every positive outscores every negative, so the rank AUC is exactly 1. probs := []float64{0.1, 0.2, 0.3, 0.7, 0.8, 0.9} y := []int{0, 0, 0, 1, 1, 1} if a := AUC(probs, y); math.Abs(a-1.0) > 1e-9 { t.Fatalf("a perfectly ranked set must have AUC 1, got %v", a) } } func TestAUCPerfectlyWrongRanking(t *testing.T) { // every negative outscores every positive, so the rank AUC is exactly 0. probs := []float64{0.9, 0.8, 0.7, 0.3, 0.2, 0.1} y := []int{0, 0, 0, 1, 1, 1} if a := AUC(probs, y); math.Abs(a) > 1e-9 { t.Fatalf("a perfectly inverted ranking must have AUC 0, got %v", a) } } func TestAUCTiesAreHalfCredit(t *testing.T) { // one positive and one negative share the same score: a tie counts as half, so AUC is 0.5. probs := []float64{0.5, 0.5} y := []int{1, 0} if a := AUC(probs, y); math.Abs(a-0.5) > 1e-9 { t.Fatalf("a single tied pair must give AUC 0.5, got %v", a) } } func TestAUCSingleClassIsHalf(t *testing.T) { // with no negatives there is nothing to discriminate against, so AUC is defined as 0.5. if a := AUC([]float64{0.2, 0.8}, []int{1, 1}); a != 0.5 { t.Fatalf("a single class must give AUC 0.5, got %v", a) } } func TestReliabilityBinsAreHandComputed(t *testing.T) { // two points land in the [0.0,0.5) bin and two in the [0.5,1.0) bin with 5 bins => width 0.2. // point 0.1 -> bin 0, 0.15 -> bin 0, 0.85 -> bin 4, 0.95 -> bin 4. probs := []float64{0.1, 0.15, 0.85, 0.95} y := []int{0, 1, 1, 1} bins := Reliability(probs, y, 5) if len(bins) != 2 { t.Fatalf("two occupied bins expected, got %d", len(bins)) } // bin 0: mean predicted (0.1+0.15)/2 = 0.125, empirical (0+1)/2 = 0.5, count 2 if math.Abs(bins[0].MeanPredicted-0.125) > 1e-9 || math.Abs(bins[0].EmpiricalRate-0.5) > 1e-9 || bins[0].Count != 2 { t.Fatalf("first bin wrong: %+v", bins[0]) } // bin 4: mean predicted (0.85+0.95)/2 = 0.9, empirical (1+1)/2 = 1.0, count 2 if math.Abs(bins[1].MeanPredicted-0.9) > 1e-9 || math.Abs(bins[1].EmpiricalRate-1.0) > 1e-9 || bins[1].Count != 2 { t.Fatalf("second bin wrong: %+v", bins[1]) } } func TestReliabilitySkipsEmptyBins(t *testing.T) { // all points in one bin: only one row comes back, empty bins are dropped. bins := Reliability([]float64{0.05, 0.06, 0.07}, []int{1, 0, 1}, 10) if len(bins) != 1 { t.Fatalf("only one occupied bin expected, got %d", len(bins)) } if bins[0].Count != 3 { t.Fatalf("the single bin must count all three points, got %d", bins[0].Count) } }

Mathematical records from this source

Search equations, builds, manuscript text, and recovered sources.