world-federation-of-advertisers / cross-media-measurement

A privacy centric system for cross publisher, cross media ads measurement through secure multiparty computations.
https://halo.wfanet.org/
Apache License 2.0
36 stars 11 forks source link

Add open telemetry metric and warning log for negative variance case. #1865

Open ple13 opened 1 month ago

ple13 commented 1 month ago

Issue: In the reach and frequency protocol, calculated variance values can sometimes be negative due to rounding errors or approximations in the computation. While mathematically, variance should always be non-negative, these small negative values can arise.

Current Solution: To address this, functions that compute variance currently return max(0.0, variance). This ensures non-negativity and maintains consistency in metric calculations. However, it can mask potentially significant issues when the variance has an unreasonably large negative value.

Proposed Improvements: Logging: Whenever a negative variance is encountered, the value should be logged. This helps in identifying and diagnosing potential problems. Threshold: Establish a threshold for acceptable negative variance values. If a calculated variance falls outside the threshold, it should trigger an alert or warning, indicating a potential issue that requires further investigation.