Skip to content

Commit c240793

Browse files
Differential Privacy Teamcopybara-github
authored andcommitted
internal change
PiperOrigin-RevId: 813634248
1 parent 8b22592 commit c240793

2 files changed

Lines changed: 21 additions & 5 deletions

File tree

cc/algorithms/quantile-tree.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,16 @@ class QuantileTree {
103103

104104
BoundedQuantilesSummary Serialize() {
105105
BoundedQuantilesSummary to_return = tree_.Serialize();
106+
to_return.set_algorithm(BoundedQuantilesSummary::TREE);
106107
to_return.set_lower(lower_);
107108
to_return.set_upper(upper_);
108109
return to_return;
109110
}
110111

111112
absl::Status Merge(const BoundedQuantilesSummary& summary) {
113+
if (summary.algorithm() != BoundedQuantilesSummary::TREE) {
114+
return absl::InternalError("Algorithm type mismatch. Expected TREE");
115+
}
112116
if (static_cast<double>(lower_) != summary.lower() ||
113117
static_cast<double>(upper_) != summary.upper()) {
114118
return absl::InternalError(absl::StrCat(

proto/summary.proto

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,31 @@ message CountSummary {
4646
}
4747

4848
message BoundedQuantilesSummary {
49-
// Distribution of the data subset, stored in the form of a quantile tree
50-
map<int32, int64> quantile_tree = 1;
49+
enum Algorithm {
50+
TREE = 0;
51+
EXPONENTIAL_DIVIDE_AND_CONQUER = 1;
52+
}
5153

52-
// Quantiles parameters:
54+
optional Algorithm algorithm = 11;
55+
56+
// Common metadata set for both algorithms.
5357
optional double epsilon = 2;
54-
optional double delta = 3;
55-
optional MechanismType mechanism_type = 4;
5658
optional double lower = 5;
5759
optional double upper = 6;
5860
optional int32 max_partitions_contributed = 7;
5961
optional int32 max_contributions_per_partition = 8;
62+
63+
// Quantile tree specific metadata.
64+
// Distribution of the data subset, stored in the form of a quantile tree
65+
optional double delta = 3;
66+
map<int32, int64> quantile_tree = 1;
67+
optional MechanismType mechanism_type = 4;
6068
optional int32 tree_height = 9;
6169
optional int32 branching_factor = 10;
70+
71+
// Exponential divide & conquer specific metadata:
72+
// The list of data point to compute quantiles for.
73+
repeated double data = 13;
6274
}
6375

6476
// Next ID: 13

0 commit comments

Comments
 (0)