Skip to content

Commit aac6faf

Browse files
committed
testing w z-score
1 parent 1ec634f commit aac6faf

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

internal/cmd/perfcomp/energystatistics.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,10 @@ func getDistance(x, y *mat.Dense) float64 {
6565
}
6666
return sum
6767
}
68+
69+
func GetZScore(x, u, o float64) float64 {
70+
if u == 0 || o == 0 {
71+
return 0
72+
}
73+
return (x - u) / o
74+
}

internal/cmd/perfcomp/main.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ type EnergyStats struct {
8585
E float64
8686
T float64
8787
H float64
88+
Z float64
8889
}
8990

9091
func main() {
@@ -217,6 +218,7 @@ func getEnergyStatsForOneBenchmark(rd RawData, coll *mongo.Collection) ([]*Energ
217218
E: e,
218219
T: t,
219220
H: h,
221+
Z: GetZScore(patchVal[0], stableRegion.Mean, stableRegion.Std),
220222
}
221223
energyStats = append(energyStats, &es)
222224
}
@@ -242,12 +244,13 @@ func generatePRComment(energyStats []*EnergyStats, version string) string {
242244
var testCount int64
243245

244246
comment.WriteString("# 👋GoDriver Performance\n")
245-
fmt.Fprintf(&comment, "The following benchmark tests for version %s had statistically significant changes (i.e., h-score > 0.6):\n", version)
246-
comment.WriteString("| Benchmark | Measurement | H-Score | Stable Reg Avg,Med,Std | Patch Value |\n| --- | --- | --- | --- | --- |\n")
247+
fmt.Fprintf(&comment, "The following benchmark tests for version %s had statistically significant changes (i.e., |z-score| > 1.96):\n", version)
248+
comment.WriteString("| Benchmark | Measurement | H-Score | Z-Score | Stable Reg Avg,Med,Std | Patch Value |\n| --- | --- | --- | --- | --- | --- |\n")
247249
for _, es := range energyStats {
248250
testCount += 1
249-
if es.H > 0.6 {
250-
fmt.Fprintf(&comment, "| %s | %s | %.4f | %.4f,%.4f,%.4f | %.4f |\n", es.Benchmark, es.Measurement, es.H, es.StableRegion.Mean, es.StableRegion.Median, es.StableRegion.Std, es.PatchValues[0])
251+
// if es.H > 0.6 {
252+
if es.Z > 1.96 || es.Z < -1.96 {
253+
fmt.Fprintf(&comment, "| %s | %s | %.4f | %.4f | %.4f,%.4f,%.4f | %.4f |\n", es.Benchmark, es.Measurement, es.H, es.Z, es.StableRegion.Mean, es.StableRegion.Median, es.StableRegion.Std, es.PatchValues[0])
251254
}
252255
}
253256

0 commit comments

Comments
 (0)