Closed Bug 1893066 Opened 2 years ago Closed 2 years ago

Fix geomean formula for raptor tests

Categories

(Testing :: Performance, task, P2)

task

Tracking

(firefox127 fixed)

RESOLVED FIXED
127 Branch
Tracking Status
firefox127 --- fixed

People

(Reporter: kshampur, Assigned: kshampur)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fxp][operational])

Attachments

(1 file)

I might be missing some historical context but this current formula is incorrect.

My guess/understanding is the log(i+1) was to avoid log(0) scenarios? however the exp(<result>) -1 to recover the original formula is incorrect? Though i understand using this logarithmic approach since any type of product() (like numpy.prod()) could cause an overflow

we could use scipys geomean?
as we already install scipy for raptor tests here and scipy already handles logarithmic divide error

(In reply to Kash Shampur [:kshampur] ⌚EST from comment #0)

I might be missing some historical context but this current formula is incorrect.

My guess/understanding is the log(i+1) was to avoid log(0) scenarios? however the exp(<result>) -1 to recover the original formula is incorrect? Though i understand using this logarithmic approach since any type of product() (like numpy.prod()) could cause an overflow

we could use scipys geomean?
as we already install scipy for raptor tests here and scipy already handles logarithmic divide error

just to add on a bit more, this can easily be verified. the geomean of [8,2] should be 4, however the current implementation would give 4.196152422706632

Just learned it also exists in the standard lib https://docs.python.org/3.8/library/statistics.html#statistics.geometric_mean
only for python >= 3.8. Checking CI it seems all our machines are on >=3.9.
before osx 10.15 was on 3.7 and looks like it is on 3.11 now, after the upgrade from relops.
win/linux are 3.9.x so it will be fine as well (and are slated to be upgraded to 3.11 eventually fwiw)

so maybe using the standard lib over scipy might be better

Component: Raptor → Performance
Summary: Fix geomean formula for raptor tests → Fix geomean formula for raptor and talos tests
Assignee: nobody → kshampur
Status: NEW → ASSIGNED

(In reply to Kash Shampur [:kshampur] ⌚EST from comment #3)

Just learned it also exists in the standard lib https://docs.python.org/3.8/library/statistics.html#statistics.geometric_mean
only for python >= 3.8. Checking CI it seems all our machines are on >=3.9.
before osx 10.15 was on 3.7 and looks like it is on 3.11 now, after the upgrade from relops.
win/linux are 3.9.x so it will be fine as well (and are slated to be upgraded to 3.11 eventually fwiw)

so maybe using the standard lib over scipy might be better

To verify this a bit further, I tried generating several non zero random arrays of varying length and compared scipy vs stdlib implementations, because I was concerned of this comment here: No special efforts are made to achieve exact results. (However, this may change in the future.)

I found that they are pretty much the same, and differences that might occur are within numerical tolerance of 1e-17 to 1e-16 so we can treat both implementations as being equivalent

edit forgot to add/check for completeness, the tolerance does depend on the order of magnitude of the elements of the array. The difference of 1e-17 to 1e-16 was for an array with elements between (0,1). If I increase the range to be between (0,10-1000) the difference adjust accordingly as well, up to to 1e-13 on the 1000 end. Just to clarify this is expected floating point error. Eitherway numpy.isclose() is happy with this

This patch updates the geometric mean formula in Raptor and Talos. The
previous implementation was old and provided only an approximate value.
As of python 3.8, the standard library has it's own implementation and
that is used here for simplicity.

See Also: → 1894323
Attachment #9399188 - Attachment description: WIP: Bug 1893066 - Fix geomean formula for Raptor and Talos tests. r?#perftest → Bug 1893066 - Fix geomean formula for Raptor and Talos tests. r?#perftest
Blocks: 1844396
See Also: → 1895340
Attachment #9399188 - Attachment description: Bug 1893066 - Fix geomean formula for Raptor and Talos tests. r?#perftest → Bug 1893066 - Fix geomean formula for Raptor. r?#perftest
Summary: Fix geomean formula for raptor and talos tests → Fix geomean formula for raptor tests
Pushed by kshampur@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/92d53efb67c7 Fix geomean formula for Raptor. r=perftest-reviewers,sparky
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 127 Branch
Regressions: 1898433
Priority: P3 → P2
Whiteboard: [fxp] → [fxp][operational]
Severity: S3 → S2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: