Skip to content

Use Gonum helpers for grader descriptive statistics - #72100

Merged
pelikhan merged 6 commits into
mainfrom
copilot/go-fan-review-gonum-module
Oct 26, 2026
Merged

pelikhan merged 6 commits into
mainfrom
copilot/go-fan-review-gonum-module

Conversation

Copilot AI commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Grader comparisons duplicate descriptive statistics already available in Gonum. Welch’s t-test also recomputes each group’s mean unnecessarily.

  • Welch t-test: Replace separate mean and variance calculations with stat.MeanVariance; remove sampleVariance.
    controlMean, controlVariance := stat.MeanVariance(control, nil)
    variantMean, variantVariance := stat.MeanVariance(variant, nil)
  • Comparison deltas: Delegate to stat.Mean, retaining the zero-for-empty guard to avoid introducing NaN.

Preserves unbiased sample variance, insufficient-sample errors, and zero-variance handling.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Review gonum.org/v1/gonum Go module Use Gonum helpers for grader descriptive statistics Oct 26, 2026
Copilot AI requested a review from pelikhan October 26, 2026 13:50
@pelikhan
pelikhan marked this pull request as ready for review October 26, 2026 13:55
Copilot AI max review requested due to automatic review settings October 26, 2026 13:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.MeanVariance in 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

Comment thread pkg/cli/experiments_grader_statistics.go
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

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.

Generated from Test Quality Sentinel · haiku45 · ~6 AIC · ⌖ ~8 AIC · ◇ ~3 AIC · ⊞ 9.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

✅ 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: reported_no_action

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.

Generated from Design Decision Gate 🏗️ · opus55 · ~12 AIC · ⌖ ~33 AIC · ◇ ~3 AIC · ⊞ 1.9K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

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.

Generated from Ponytail Reviewer · gpt56 · ~6 AIC · ⌖ ~6 AIC · ⊞ 14.8K · ◷

Generated by Ponytail Reviewer for #72100

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.MeanVariance semantics checked against the gonum v0.17.0 source — unbiased sample variance (n-1 denominator) and mean formulas match the previous hand-rolled implementation exactly, so this is a pure delegation with no behavior change.
  • Test quality: TestWelchTTest is now table-driven with 6 cases including zero-variance, unequal sizes, and symmetry checks (welchTTest(a,b) vs welchTTest(b,a)), a solid upgrade from the single pre-existing case per /tdd.
  • Minor consistency gap: meanGraderObservations still hand-rolls its sum loop instead of reusing stat.Mean, leaving the file half-migrated to Gonum (see inline comment).

Positive Highlights

  • ✅ sampleVariance cleanly removed, no longer duplicating stat.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.

@pelikhan

Copy link
Copy Markdown
Collaborator

@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>

Copilot AI commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Fix the code for all comments in this review thread.

When a review comment includes a suggested change, apply the s...

Fixed in fac371f.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Fix failing check impacted-go-tests (FAILURE): https://github.com/github/gh-aw/actions/runs/40348605627/job/121665047000.

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
Sous-chef work: 42e5d572d9d75b7168fe7d0aeda0717cc07e65ed240f6d299e6fec661214f1ac
Sous-chef state: 390759731352490f10b65285d135566198cbca559989f9c38e4a99eb1ad3a030

Generated by 👨‍🍳 PR Sous Chef · pi · haiku45 · ~5 AIC · ⌖ ~8 AIC · ⊞ 1.1K · ◷
Comment /souschef to run again

…-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>

Copilot AI commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes....

Merged the latest main with make merge-main (afc13c1). Fixed the impacted-go-tests failure in a9ed8e4 by stubbing the downloader and asserting duplicate section imports trigger only one attempt; the focused test and sampled impacted tests pass. make lint passes, but the change-scoped gate still reports existing custom-linter findings on unchanged lines of pkg/cli/experiments_grader_statistics.go. The linked review thread already has Copilot’s substantive reply, but I could not resolve it because this environment’s GitHub CLI has no GH_TOKEN. I did not trigger CI.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Fix failing check impacted-go-tests (FAILURE): https://github.com/github/gh-aw/actions/runs/40358428919/job/121701311454.

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

Generated by 👨‍🍳 PR Sous Chef · pi · haiku45 · ~10 AIC · ⌖ ~18 AIC · ⊞ 1.1K · ◷
Comment /souschef to run again

…-gonum-module

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes....

Merged the latest main as 16c9c3c. The failing test now passes on the merged branch (100 focused repetitions, plus the final impacted Go tests). The linked review thread is already resolved. I did not trigger CI; make agent-report-progress also reports six existing custom-linter findings in experiments_grader_statistics.go.

@pelikhan
pelikhan merged commit 082e6f2 into main Oct 26, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[go-fan] Go Module Review: gonum.org/v1/gonum

4 participants