Repository navigation
Use Gonum helpers for grader descriptive statistics - #72100
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Identical constant samples with unequal sizes can produce a false significant result and an incorrect experiment recommendation.
1 open issue
What changed in this PR
This PR simplifies grader experiment comparisons by replacing custom descriptive-statistics calculations with Gonum helpers.
Changes:
- Uses
stat.MeanVariancein Welch’s t-test and removes the custom variance helper. - Delegates means to
stat.Mean, preserving the empty-input guard. - Expands tests for statistical results, zero-variance samples, and insufficient observations.
| File | Description |
|---|---|
pkg/cli/experiments_grader_statistics.go |
Replaces custom mean and variance calculations with Gonum helpers. |
pkg/cli/experiments_grader_observations_test.go |
Expands mean and Welch’s t-test coverage. |
Review effort: Max
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Design Decision Gate 🏗️Outcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
There was a problem hiding this comment.
Review summary
No new actionable issues found in the changed lines. The Gonum helper substitution preserves the sample-variance Welch calculation, empty-input handling, and degenerate-variance behavior; the added tests cover the principal cases. Existing low-severity concerns about exact floating-point zero-variance checks and tightly pinned numeric tolerances are non-blocking and are already represented in the review context.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /codebase-design and /tdd — small, correct refactor with good test coverage; approving with one minor non-blocking suggestion.
📋 Key Themes & Highlights
Key Themes
- Correctness verified:
stat.Mean/stat.MeanVariancesemantics checked against the gonum v0.17.0 source — unbiased sample variance (n-1denominator) and mean formulas match the previous hand-rolled implementation exactly, so this is a pure delegation with no behavior change. - Test quality:
TestWelchTTestis now table-driven with 6 cases including zero-variance, unequal sizes, and symmetry checks (welchTTest(a,b)vswelchTTest(b,a)), a solid upgrade from the single pre-existing case per/tdd. - Minor consistency gap:
meanGraderObservationsstill hand-rolls its sum loop instead of reusingstat.Mean, leaving the file half-migrated to Gonum (see inline comment).
Positive Highlights
- ✅
sampleVariancecleanly removed, no longer duplicatingstat.MeanVariance - ✅ Zero-variance guard preserved to avoid
NaN - ✅ Insufficient-observations error path explicitly covered by its own test
A reviewer (Copilot) already flagged a real edge-case risk at a different line (rounding causing a false zero-variance branch) — worth checking before merge, though it is pre-existing behavior rather than something introduced by this PR.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · ~50 AIC · ⌖ ~15 AIC · ⊞ 10.2K
Comment /matt to run again
Comments that could not be inline-anchored
pkg/cli/experiments_grader_statistics.go:25
[/codebase-design] Nice use of stat.Mean/stat.MeanVariance below, but meanGraderObservations (same file, same PR theme) still hand-rolls its summation loop instead of delegating to stat.Mean on the extracted values. Minor inconsistency in vocabulary for an otherwise focused "use Gonum for descriptive stats" refactor.
Content redacted to fit size limit.
@copilot please address this.
|
@copilot Fix the code for all comments in this review thread. When a review comment includes a suggested change, apply the suggestion exactly. Do not make changes beyond what is described in the linked review thread. |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed in fac371f. |
|
@copilot address the following outstanding work in one pass:
Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI. Sous-chef head: fac371f
|
…-gonum-module Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Merged the latest |
|
@copilot address the following outstanding work in one pass:
Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI. Sous-chef state: 1063f95574ae0c14541a541ca75a87909f04d007c8e467c2c0048a59edc962c0
|
…-gonum-module Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Merged the latest |

Grader comparisons duplicate descriptive statistics already available in Gonum. Welch’s t-test also recomputes each group’s mean unnecessarily.
stat.MeanVariance; removesampleVariance.stat.Mean, retaining the zero-for-empty guard to avoid introducingNaN.Preserves unbiased sample variance, insufficient-sample errors, and zero-variance handling.