Switch reports to hourly contribution interval
Updates the population value to 24 * n pseudousers to account for the
hourly contribution interval for FLEETWIDE_OCCURRENCE_COUNTS and
FLEETWIDE_HISTOGRAMS report types.
The unit tests have been updated with the new error calculation.
Change-Id: I56e6ebeaf3228c545cbb3078f14cf6206a14c2c9
Reviewed-on: https://fuchsia-review.googlesource.com/c/cobalt/+/473303
Commit-Queue: Jared Weinstein <jaredweinstein@google.com>
Reviewed-by: Laura Peskin <pesk@google.com>
diff --git a/src/bin/config_parser/src/privacy/error_calculator.go b/src/bin/config_parser/src/privacy/error_calculator.go
index af03066..357d937 100644
--- a/src/bin/config_parser/src/privacy/error_calculator.go
+++ b/src/bin/config_parser/src/privacy/error_calculator.go
@@ -49,6 +49,7 @@
return -1, err
}
+ // For report types with an hourly contribution interval, the population is set to (24*population) pseudo-users.
var errorEstimate float64
switch report.GetReportType() {
case config.ReportDefinition_UNIQUE_DEVICE_HISTOGRAMS:
@@ -56,12 +57,11 @@
case config.ReportDefinition_UNIQUE_DEVICE_COUNTS:
errorEstimate = SingleContributionRapporRMSE(population, privacyEncodingParams)
case config.ReportDefinition_HOURLY_VALUE_HISTOGRAMS:
- // (24 * population) pseudo-users to account for hourly values.
errorEstimate = SingleContributionRapporRMSE(24*population, privacyEncodingParams)
case config.ReportDefinition_FLEETWIDE_OCCURRENCE_COUNTS:
- errorEstimate = MultipleContributionRapporRMSE(population, privacyEncodingParams, report.MaxCount)
+ errorEstimate = MultipleContributionRapporRMSE(24*population, privacyEncodingParams, report.MaxCount)
case config.ReportDefinition_FLEETWIDE_HISTOGRAMS:
- errorEstimate = MultipleContributionRapporRMSE(population, privacyEncodingParams, 1)
+ errorEstimate = MultipleContributionRapporRMSE(24*population, privacyEncodingParams, 1)
case config.ReportDefinition_UNIQUE_DEVICE_NUMERIC_STATS:
if err := meanReportConfigurationError(report, minDenominatorEstimate); err != nil {
return -1, err
@@ -71,7 +71,6 @@
if err := meanReportConfigurationError(report, minDenominatorEstimate); err != nil {
return -1, err
}
- // (24 * population) pseudo-users to account for hourly values.
errorEstimate = NumericStatsRapporRMSE(24*population, privacyEncodingParams, minDenominatorEstimate, report)
case config.ReportDefinition_FLEETWIDE_MEANS:
if err := meanReportConfigurationError(report, minDenominatorEstimate); err != nil {
diff --git a/src/bin/config_parser/src/privacy/error_calculator_test.go b/src/bin/config_parser/src/privacy/error_calculator_test.go
index ebb4eab..89df399 100644
--- a/src/bin/config_parser/src/privacy/error_calculator_test.go
+++ b/src/bin/config_parser/src/privacy/error_calculator_test.go
@@ -119,13 +119,13 @@
{args{&testMetric, &hourlyValueHistogram, 1, 20000, 0}, true, 34.19422624116276},
// Multi-contribution reports
- {args{&testMetric, &fleetwideOccurrenceCount, 1, 10000, 0}, true, 10.796886170985388},
- {args{&testMetric, &fleetwideOccurrenceCount, 10, 10000, 0}, true, 7.640513872793125},
- {args{&testMetric, &fleetwideOccurrenceCount, 1, 20000, 0}, true, 15.269102854406052},
- {args{&testMetric, &fleetwideOccurrenceCountHighMax, 1, 10000, 0}, true, 43.18754468394155},
- {args{&testMetric, &fleetwideHistogram, 1, 10000, 0}, true, 10.796886170985388},
- {args{&testMetric, &fleetwideHistogram, 10, 10000, 0}, true, 7.640513872793125},
- {args{&testMetric, &fleetwideHistogram, 1, 20000, 0}, true, 15.269102854406052},
+ {args{&testMetric, &fleetwideOccurrenceCount, 1, 10000, 0}, true, 52.893723859652496},
+ {args{&testMetric, &fleetwideOccurrenceCount, 10, 10000, 0}, true, 37.430720721998675},
+ {args{&testMetric, &fleetwideOccurrenceCount, 1, 20000, 0}, true, 74.80302164673793},
+ {args{&testMetric, &fleetwideOccurrenceCountHighMax, 1, 10000, 0}, true, 211.57489543860999},
+ {args{&testMetric, &fleetwideHistogram, 1, 10000, 0}, true, 52.893723859652496},
+ {args{&testMetric, &fleetwideHistogram, 10, 10000, 0}, true, 37.430720721998675},
+ {args{&testMetric, &fleetwideHistogram, 1, 20000, 0}, true, 74.80302164673793},
// Mean reports
{args{&testMetric, &uniqueDeviceNumericStats, 1, 10000, 500}, true, 0.027891803930152177},