ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Janady13/missionmatch / internal/platform/learn/pairwise_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/pairwise_test.go
DateNot specified in source
RepositoryJanady13/missionmatch
Revision720d47fae476b0d38477ae4401697d372b1ea2bc
Branchfeature/opportunity-to-outcome
Path or archive memberinternal/platform/learn/pairwise_test.go
Original SHA-25641abb1943bd564a1d2ca245e6e501f09c4a60b0b19084a4aecb173ae8ccbf2d1
Git blob SHAee088538f011d0d26039fa75b6a0e13d3e8b9e02
Reading-copy SHA-25641abb1943bd564a1d2ca245e6e501f09c4a60b0b19084a4aecb173ae8ccbf2d1

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/pairwise_test.gofeature/opportunity-to-outcome720d47fae476b0d38477ae4401697d372b1ea2bcOpen original
Janady13/missionmatch / internal/platform/learn/pairwise_test.gocollision-deconfliction4ee5a09972608ed89f8377c6665542d5f450f0a6Open original
Janady13/missionmatch / internal/platform/learn/pairwise_test.gomaster1e9249840a4302ec82e123b9c9cb6f75badea3e4Open original
Janady13/missionmatch / internal/platform/learn/pairwise_test.gomag-substrateb82c7100a492dec67dfd1eda6b3f53def859be35Open original
Janady13/missionmatch / internal/platform/learn/pairwise_test.gotime-to-fill-survivalb66e1e505863d4f17741a4b9ede73509e45bd6c6Open original
Janady13/missionmatch / internal/platform/learn/pairwise_test.gopresentation-readinesseb574acaa29d71ce4d0f852572e87c275c79fdb7Open original
Janady13/missionmatch / internal/platform/learn/pairwise_test.govendor-intelligencefe9796a19c261951d3f2565206c0c1b5ac294465Open original
Janady13/missionmatch / internal/platform/learn/pairwise_test.gophase2-connectorse038d4c687aec16f8bd9bc4d907eea14d91f8704Open original
Janady13/missionmatch / internal/platform/learn/pairwise_test.gofeature/aioe-upgrade2178e7298d0e5d9af83afa12402fd587f0ba6ed8Open original
Janady13/missionmatch / internal/platform/learn/pairwise_test.gocapture-readinessbae6af7cb2997e819174a9e9cfff5e16067a1975Open original

Recovered source transcript

package learn import ( "math" "testing" ) // a group where feature 0 perfectly separates approved (high) from rejected (low). func rankFixture() []RankGroup { return []RankGroup{ {Items: []RankItem{ {Features: []float64{0.9, 0.5}, Approved: true}, {Features: []float64{0.8, 0.4}, Approved: true}, {Features: []float64{0.2, 0.6}, Approved: false}, {Features: []float64{0.1, 0.5}, Approved: false}, }}, {Items: []RankItem{ {Features: []float64{0.95, 0.3}, Approved: true}, {Features: []float64{0.15, 0.7}, Approved: false}, }}, } } func TestPairwiseDatasetIsSymmetric(t *testing.T) { groups := []RankGroup{{Items: []RankItem{ {Features: []float64{1, 2}, Approved: true}, {Features: []float64{0, 1}, Approved: false}, }}} x, y := PairwiseDataset(groups) // one approved and one rejected => one pair => two symmetric rows. if len(x) != 2 || len(y) != 2 { t.Fatalf("one pair must produce two symmetric rows, got %d", len(x)) } // row 0 is a minus b with label 1, row 1 is b minus a with label 0, exact negatives. if y[0] != 1 || y[1] != 0 { t.Fatalf("labels must be 1 then 0, got %v", y) } for j := range x[0] { if x[0][j] != -x[1][j] { t.Fatalf("the symmetric rows must be exact negatives, got %v and %v", x[0], x[1]) } } } func TestPairwiseDatasetSkipsUnanimousGroups(t *testing.T) { // a slate everyone approved carries no ordering signal, so it produces no pair. groups := []RankGroup{{Items: []RankItem{ {Features: []float64{1, 1}, Approved: true}, {Features: []float64{2, 2}, Approved: true}, }}} x, _ := PairwiseDataset(groups) if len(x) != 0 { t.Fatalf("a unanimous group must produce no pairs, got %d", len(x)) } } func TestPairwiseFitLearnsTheOrdering(t *testing.T) { groups := rankFixture() x, y := PairwiseDataset(groups) m, err := FitLogistic(x, y, 0.01) if err != nil { t.Fatalf("pairwise fit: %v", err) } // the raw space coefficients (utility weights): feature 0 separates, so its coefficient must be positive. coeffs := make([]float64, len(m.Coeffs)) for j := range m.Coeffs { coeffs[j] = m.Coeffs[j] / m.Scales[j] } if coeffs[0] <= 0 { t.Fatalf("the separating feature must get a positive utility weight, got %v", coeffs[0]) } // the learned utility must order every approved above every rejected: perfect pairwise accuracy. if acc := PairwiseAccuracy(groups, coeffs); acc < 0.99 { t.Fatalf("the learned utility must order the separable fixture perfectly, got accuracy %v", acc) } } func TestPairwiseAccuracyBounds(t *testing.T) { groups := rankFixture() // a weight vector that inverts the order (negative on the separating feature) must score below 0.5. if acc := PairwiseAccuracy(groups, []float64{-1, 0}); acc > 0.5 { t.Errorf("an inverting weight must score at or below 0.5, got %v", acc) } // the engine like positive weight orders the fixture correctly. if acc := PairwiseAccuracy(groups, []float64{1, 0}); acc < 0.99 { t.Errorf("a correct weight must score near 1.0, got %v", acc) } // equal utilities (zero weights) are all ties => 0.5. if acc := PairwiseAccuracy(groups, []float64{0, 0}); math.Abs(acc-0.5) > 1e-9 { t.Errorf("all ties must score exactly 0.5, got %v", acc) } } func TestRankUtility(t *testing.T) { if u := RankUtility([]float64{2, 3}, []float64{1, 10}); u != 32 { t.Fatalf("utility must be the dot product, got %v", u) } }

Mathematical records from this source

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