[perf] LSE calc for OriginalStep is wrong.
Just document it for now.
Bug: skia:10488
Change-Id: Ia766c1d67fc263f978d3e9397bc4476d64ad2b75
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/301946
Commit-Queue: Joe Gregorio <jcgregorio@google.com>
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
diff --git a/perf/go/stepfit/stepfit.go b/perf/go/stepfit/stepfit.go
index 3575b43..b035109 100644
--- a/perf/go/stepfit/stepfit.go
+++ b/perf/go/stepfit/stepfit.go
@@ -119,6 +119,8 @@
stepSize = (y0 - y1)
}
}
+ // The next line of code should actually be math.Sqrt(lse/len(trace))
+ // instead it is math.Sqrt(lse)/len(trace), which does not give the stddev.
lse = float32(math.Sqrt(float64(lse))) / float32(len(trace))
if lse < stddevThreshold {
regression = stepSize / stddevThreshold
diff --git a/perf/go/stepfit/stepfit_test.go b/perf/go/stepfit/stepfit_test.go
index f7d0e65..ea7d228 100644
--- a/perf/go/stepfit/stepfit_test.go
+++ b/perf/go/stepfit/stepfit_test.go
@@ -31,6 +31,15 @@
GetStepFitAtMid([]float32{0, 0, 1, 1, 1}, minStdDev, 20, types.OriginalStep))
}
+func TestStepFit_RealWorldExample(t *testing.T) {
+ unittest.SmallTest(t)
+ assert.Equal(t,
+ &StepFit{LeastSquares: 0.17183419, TurningPoint: 1, StepSize: -2.0251877, Regression: -11.785709, Status: "High"},
+ GetStepFitAtMid([]float32{608100,
+ 672970,
+ 653180}, minStdDev, 2, types.OriginalStep))
+}
+
func TestStepFit_SimpleStepDown(t *testing.T) {
unittest.SmallTest(t)
assert.Equal(t,