Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output uniformly random guess at frequency distribution when reach is too small #1498

Conversation

riemanli
Copy link
Contributor

@riemanli riemanli commented Feb 21, 2024

The variance calculation of frequency distribution will output NaN when reach is zero. Moreover, the estimated variance is not accurate when reach is impractically small. The solution is to check whether the reach is too small using its confidence interval. If the confidence interval of the reach contains values <= 0, we claim the reach is too small for an accurate variance estimate of frequency distribution, and output the variance of uniformly random draw from [0, 1].

@wfa-reviewable
Copy link

This change is Reviewable

@riemanli
Copy link
Contributor Author

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

Copy link
Contributor

@jiayu-google jiayu-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: 0 of 4 files reviewed, 1 unresolved discussion (waiting on @chenweiw and @riemanli)


src/main/kotlin/org/wfanet/measurement/measurementconsumer/stats/LiquidLegions.kt line 275 at r1 (raw file):

    // When reach is too small, we have little info to estimate frequency, and thus the estimate of
    // relative frequency is equivalent to a uniformly random guess at probability.

nit: "uniformly random guess of a probability in [0, 1]."

Copy link

@chenweiw chenweiw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @riemanli)


src/main/kotlin/org/wfanet/measurement/measurementconsumer/stats/MeasurementStatistics.kt line 91 at r1 (raw file):

 * A reach result is considered too small when computing variances of relative frequency if the 95%
 * confidence interval of the reach covers 0 or negative values. The 95% confidence interval =
 * reach_result +/- 1.96 * reach_std.

Do we always consider "95%" confidence interval here or is "95%" defined by the customer's input? If it is the former, then nothing needs to be changed.

@riemanli riemanli force-pushed the riemanli_fix_frequency_measurement_variance_when_reach_is_too_small branch from 0963363 to 675b83b Compare February 23, 2024 03:59
Copy link
Contributor Author

@riemanli riemanli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 2 of 4 files reviewed, 1 unresolved discussion (waiting on @chenweiw and @stevenwarejones)


src/main/kotlin/org/wfanet/measurement/measurementconsumer/stats/LiquidLegions.kt line 275 at r1 (raw file):

Previously, jiayu-google wrote…

nit: "uniformly random guess of a probability in [0, 1]."

Done.


src/main/kotlin/org/wfanet/measurement/measurementconsumer/stats/MeasurementStatistics.kt line 91 at r1 (raw file):

Previously, chenweiw wrote…

Do we always consider "95%" confidence interval here or is "95%" defined by the customer's input? If it is the former, then nothing needs to be changed.

It's hardcoded right now. Not sure if it makes sense to let user control this.

Copy link

@chenweiw chenweiw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 2 of 4 files reviewed, all discussions resolved (waiting on @stevenwarejones)

Copy link

@chenweiw chenweiw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 2 of 4 files reviewed, all discussions resolved (waiting on @stevenwarejones)

Copy link
Collaborator

@stevenwarejones stevenwarejones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 4 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @riemanli)

@riemanli riemanli force-pushed the riemanli_fix_frequency_measurement_variance_when_reach_is_too_small branch from 675b83b to 30e69c9 Compare February 26, 2024 22:57
@riemanli riemanli enabled auto-merge (squash) February 26, 2024 22:58
@riemanli riemanli merged commit 05abea3 into main Feb 26, 2024
5 of 6 checks passed
@riemanli riemanli deleted the riemanli_fix_frequency_measurement_variance_when_reach_is_too_small branch February 26, 2024 23:09
ple13 pushed a commit that referenced this pull request Aug 16, 2024
… too small (#1498)

The variance calculation of frequency distribution will output `NaN` when reach is zero. Moreover, the estimated variance is not accurate when reach is impractically small. The solution is to check whether the reach is too small using its confidence interval. If the confidence interval of the reach contains values <= 0, we claim the reach is too small for an accurate variance estimate of frequency distribution, and output the variance of uniformly random draw from [0, 1].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants