πΉ Go Fan Report: gonum.org/v1/gonum
Module Overview
Gonum is the umbrella numerical-computing suite for Go (linear algebra, statistics, graph algorithms, optimization). gh-aw only depends on the stat/distuv subpackage β univariate probability distributions (PDFs/CDFs) used for statistical hypothesis testing.
Current Usage in gh-aw
- Files: 1 (
pkg/cli/experiments_grader_statistics.go)
- Import Count: 1 (
gonum.org/v1/gonum/stat/distuv)
- Key APIs Used:
distuv.StudentsT.CDF (Welch's t-test), distuv.UnitNormal.CDF (Mann-Whitney, two-proportion z-test), distuv.Beta.Prob/.CDF (Bayesian A/B numerical integration)
This file backs gh aw's grader-experiment statistics engine: comparing control vs. variant metric observations across four configurable analysis types (t_test, mann_whitney, proportion_test, bayesian_ab).
Research Findings
Version: gh-aw already pins v0.17.0, which is the latest release (published 2026-01-10) β no upgrade needed.
Recent Updates (v0.16.0 β v0.17.0)
distuv.NoncentralT, Umeyama point-pattern alignment in spatial, optimize.MinimumStepSize, mathext.Li2/Hypergeo, Dinic max-flow + eccentricity/diameter in graph/network, Wasserstein distance in stat. None are a direct fit for gh-aw's current grader-statistics feature.
Best Practices
Gonum deliberately ships only distributions and descriptive statistics (stat.Mean, stat.Variance, stat.MeanVariance, stat.StdDev, stat.Covariance/Correlation) β it does not provide hypothesis-test helpers (no TTest, MannWhitneyUTest, or ProportionTest exist anywhere in the module, confirmed via repo code search). gh-aw's choice to implement Welch's t-test, Mann-Whitney U, and proportion tests itself β while consuming Gonum only for the distribution CDFs β is the expected and idiomatic way to use this library.
Full analysis detail
Quick win identified: experiments_grader_statistics.go hand-rolls meanValues() and sampleVariance() (two-pass sample mean/variance over []float64). Gonum's stat package already exports stat.Mean(x, weights) and stat.Variance(x, weights) with the same numerically-stable two-pass algorithm, well-tested in the upstream module already present in the dependency graph. Swapping these two helpers for the library calls removes ~15 lines of duplicated arithmetic with no behavior change (pass nil for unweighted).
Not a fit: the Bayesian A/B posterior comparison (betaBinomialProbability) numerically integrates variantPosterior.Prob(x) * controlPosterior.CDF(x) over 4096 fixed intervals. Gonum's distuv.Beta doesn't expose a closed-form "P(variant > control)" helper for two Beta posteriors, so this custom quadrature is the correct approach β no simpler Gonum API exists for it.
Full write-up saved to scratchpad/mods/gonum.md.
Improvement Opportunities
π Quick Wins
- Replace
meanValues() / sampleVariance() in experiments_grader_statistics.go with stat.Mean(x, nil) / stat.Variance(x, nil) from gonum.org/v1/gonum/stat.
β¨ Feature Opportunities
- If confidence-interval reporting is added later,
distuv's Quantile (inverse CDF) methods could report CIs alongside p-values without a new dependency.
π Best Practice Alignment
- Current usage already matches Gonum's intended design β no hypothesis-test logic is missing from the library; nothing to align further here.
π§ General Improvements
- None beyond the quick win above β the module footprint in gh-aw is small (1 file) and already well-scoped to just the distribution math it's needed for.
Recommendations
- Replace the two hand-rolled mean/variance helpers with
gonum.org/v1/gonum/stat.Mean/stat.Variance β small, low-risk cleanup.
- No version bump needed; v0.17.0 is current.
- No action needed on best-practice alignment or feature adoption at this time.
Next Steps
- Optional follow-up PR: swap
meanValues/sampleVariance for stat.Mean/stat.Variance in pkg/cli/experiments_grader_statistics.go.
Generated by Go Fan
Module summary saved to: scratchpad/mods/gonum.md
Generated by πΉ Go Fan Β· claude Β· agent Β· 239.4 AIC Β· β 8.04 AIC Β· β 6.4K Β· β·
πΉ Go Fan Report: gonum.org/v1/gonum
Module Overview
Gonum is the umbrella numerical-computing suite for Go (linear algebra, statistics, graph algorithms, optimization). gh-aw only depends on the
stat/distuvsubpackage β univariate probability distributions (PDFs/CDFs) used for statistical hypothesis testing.Current Usage in gh-aw
pkg/cli/experiments_grader_statistics.go)gonum.org/v1/gonum/stat/distuv)distuv.StudentsT.CDF(Welch's t-test),distuv.UnitNormal.CDF(Mann-Whitney, two-proportion z-test),distuv.Beta.Prob/.CDF(Bayesian A/B numerical integration)This file backs
gh aw's grader-experiment statistics engine: comparing control vs. variant metric observations across four configurable analysis types (t_test,mann_whitney,proportion_test,bayesian_ab).Research Findings
Version: gh-aw already pins
v0.17.0, which is the latest release (published 2026-01-10) β no upgrade needed.Recent Updates (v0.16.0 β v0.17.0)
distuv.NoncentralT, Umeyama point-pattern alignment inspatial,optimize.MinimumStepSize,mathext.Li2/Hypergeo, Dinic max-flow + eccentricity/diameter ingraph/network, Wasserstein distance instat. None are a direct fit for gh-aw's current grader-statistics feature.Best Practices
Gonum deliberately ships only distributions and descriptive statistics (
stat.Mean,stat.Variance,stat.MeanVariance,stat.StdDev,stat.Covariance/Correlation) β it does not provide hypothesis-test helpers (noTTest,MannWhitneyUTest, orProportionTestexist anywhere in the module, confirmed via repo code search). gh-aw's choice to implement Welch's t-test, Mann-Whitney U, and proportion tests itself β while consuming Gonum only for the distribution CDFs β is the expected and idiomatic way to use this library.Full analysis detail
Quick win identified:
experiments_grader_statistics.gohand-rollsmeanValues()andsampleVariance()(two-pass sample mean/variance over[]float64). Gonum'sstatpackage already exportsstat.Mean(x, weights)andstat.Variance(x, weights)with the same numerically-stable two-pass algorithm, well-tested in the upstream module already present in the dependency graph. Swapping these two helpers for the library calls removes ~15 lines of duplicated arithmetic with no behavior change (passnilfor unweighted).Not a fit: the Bayesian A/B posterior comparison (
betaBinomialProbability) numerically integratesvariantPosterior.Prob(x) * controlPosterior.CDF(x)over 4096 fixed intervals. Gonum'sdistuv.Betadoesn't expose a closed-form "P(variant > control)" helper for two Beta posteriors, so this custom quadrature is the correct approach β no simpler Gonum API exists for it.Full write-up saved to
scratchpad/mods/gonum.md.Improvement Opportunities
π Quick Wins
meanValues()/sampleVariance()inexperiments_grader_statistics.gowithstat.Mean(x, nil)/stat.Variance(x, nil)fromgonum.org/v1/gonum/stat.β¨ Feature Opportunities
distuv'sQuantile(inverse CDF) methods could report CIs alongside p-values without a new dependency.π Best Practice Alignment
π§ General Improvements
Recommendations
gonum.org/v1/gonum/stat.Mean/stat.Varianceβ small, low-risk cleanup.Next Steps
meanValues/sampleVarianceforstat.Mean/stat.Varianceinpkg/cli/experiments_grader_statistics.go.Generated by Go Fan
Module summary saved to: scratchpad/mods/gonum.md