GoogleChrome / GoogleChrome/lighthouse

ByteEfficiencyAudits use piecewise raw to score functions

Open
#11,883 2 comments 0 reactions 1 assignee Claimed by @brendankenny View on GitHub
good first issue P3
Dominant language
JavaScript
Stars
30.8k
Forks
9.8k
Avg merge
1d 20h
Merged PRs (30d)
19

Description

The byte efficiency audits use a secoring functions that is defined by linear interpolation between three control points: `{0, p_avg, p_poor, p_zero}`, the positions between which are defined by linear interpolation between the points. Here is the curve from byte-efficiency-audit.js with `control points={0, 300, 750, 5000}`, forming what looks like an approximation of a convex curve:

![screenshot2](https://user-images.githubusercontent.com/1451261/103018092-ec54b880-4544-11eb-9887-862dc7406ae8.jpg)

Having such a piecewise function is undesirable for two resons: (1) It complicates the code (2) it can increase variance when measures values lie close to the control points.
Choosing `p10=90, median=700` this curve can be approximated using the standard log normal distribution. These values where chosen manually using the sliders. The error is biggest towards the lower end of the scores. The parameters could be chosen methodically by using a function fitting tool like the one from gnuplot.

![screenshot2](https://user-images.githubusercontent.com/1451261/103018451-93d1eb00-4545-11eb-9e83-a10738cd88b5.jpg)

If using the control points is desirable for some reason, another, smooth interpolation method could be used (e.g. cubic, finding a spline, …).

Here's the desmos functions I've used if you would like to play around.

$
g\left(x_{0},y_{0},x_{1},y_{1},x\right)=y_{0}+\left(x-x_{0}\right)\cdot\frac{y_{1}-y_{0}}{x_{1}-x_{0}}
p_{0}=5000
p_{poor}=750
p_{avg}=300
l\left(x\right)=\left\{0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.