-
Notifications
You must be signed in to change notification settings - Fork 11
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
fix: ensure kplus reach ratio not exceeding 1.0 #1868
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ple13)
src/main/kotlin/org/wfanet/measurement/measurementconsumer/stats/Variances.kt
line 451 at r1 (raw file):
(maximumFrequency downTo 1).associateWith { frequency -> suffixSum += params.relativeFrequencyDistribution.getOrDefault(frequency, 0.0) require(suffixSum <= 1.0 + TOLERANCE) {
Shouldn't the tolerance go in both directions? i.e. 1.0 ± tolerance?
Code quote:
1.0 + TOLERANCE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @SanjayVas)
src/main/kotlin/org/wfanet/measurement/measurementconsumer/stats/Variances.kt
line 451 at r1 (raw file):
Previously, SanjayVas (Sanjay Vasandani) wrote…
Shouldn't the tolerance go in both directions? i.e. 1.0 ± tolerance?
We only need to check for one side as any value in [0.0, 1.0] is valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ple13)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ple13)
src/main/kotlin/org/wfanet/measurement/measurementconsumer/stats/Variances.kt
line 451 at r1 (raw file):
(maximumFrequency downTo 1).associateWith { frequency -> suffixSum += params.relativeFrequencyDistribution.getOrDefault(frequency, 0.0) require(suffixSum <= 1.0 + TOLERANCE) {
I'd prefer this be done with a function isLessThanWithTolerance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @stevenwarejones)
src/main/kotlin/org/wfanet/measurement/measurementconsumer/stats/Variances.kt
line 451 at r1 (raw file):
Previously, stevenwarejones (Steven Ware Jones) wrote…
I'd prefer this be done with a function
isLessThanWithTolerance
FWIW, the similar function in the Guava library is called fuzzyEquals
. In Kotlin, this could be implemented as an extension with the following signature:
fun Double.fuzzyEquals(other: Double, tolerance: Double): Boolean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @SanjayVas and @stevenwarejones)
src/main/kotlin/org/wfanet/measurement/measurementconsumer/stats/Variances.kt
line 451 at r1 (raw file):
Previously, SanjayVas (Sanjay Vasandani) wrote…
FWIW, the similar function in the Guava library is called
fuzzyEquals
. In Kotlin, this could be implemented as an extension with the following signature:fun Double.fuzzyEquals(other: Double, tolerance: Double): Boolean
Done. Please let me know if you prefer the function to be moved to measurement/common.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @SanjayVas)
src/main/kotlin/org/wfanet/measurement/measurementconsumer/stats/Variances.kt
line 451 at r1 (raw file):
Previously, ple13 (Phi) wrote…
Done. Please let me know if you prefer the function to be moved to measurement/common.
i'd prefer it be moved to common
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @SanjayVas and @stevenwarejones)
src/main/kotlin/org/wfanet/measurement/measurementconsumer/stats/Variances.kt
line 451 at r1 (raw file):
Previously, stevenwarejones (Steven Ware Jones) wrote…
i'd prefer it be moved to common
Can we just call the Guava function directly?
- it already exists and does what we want
- it's a one off call, thus no Kotlin wrapper is needed
- were not building a reusable math library, so we really need this in common with a set of tests, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @SanjayVas and @stevenwarejones)
src/main/kotlin/org/wfanet/measurement/measurementconsumer/stats/Variances.kt
line 451 at r1 (raw file):
Previously, kungfucraig (Craig Wright) wrote…
Can we just call the Guava function directly?
- it already exists and does what we want
- it's a one off call, thus no Kotlin wrapper is needed
- were not building a reusable math library, so we really need this in common with a set of tests, etc.
Thanks. I've updated it to use fuzzyCompare.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @SanjayVas and @stevenwarejones)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @stevenwarejones)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ple13)
…ution.