Skip to content

Create error estimator for SUM - #528

Merged
dvadym merged 2 commits into
OpenMined:mainfrom
dvadym:sum_histogram_estimator
Oct 17, 2024
Merged

dvadym merged 2 commits into
OpenMined:mainfrom
dvadym:sum_histogram_estimator

Conversation

@dvadym

@dvadym dvadym commented Oct 16, 2024

Copy link
Copy Markdown
Collaborator

ErrorEstimator uses ContributionHistograms to estimate approximately RMSE error for different L0/Linf bounds. This PR allows to create ErrorEstimator for SUM (the different with COUNT, only different set of histograms)

@dvadym
dvadym requested a review from RamSaw October 16, 2024 13:20
ratio_dropped_linf = self.get_ratio_dropped_linf(linf_bound)
ratio_dropped = 1 - (1 - ratio_dropped_l0) * (1 - ratio_dropped_linf)
stddev = self._get_stddev(l0_bound, linf_bound)
if to_print:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is it for debugging only? should we remove it? just double checking :)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, thanks. Removed

Comment thread pipeline_dp/dataset_histograms/histogram_error_estimator.py Outdated
delta: Optional[float] = None,
):
return histogram_error_estimator.create_error_estimator(
return histogram_error_estimator.create_estimator_for_count_privacy_id_count(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would rename from _get_estimator to _get_estimator_for_count_and_privacy_id_count.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

thx, done


@parameterized.parameters((0, 1), (0.5, 0.89), (1, 0.78), (2, 0.76),
(40, 0))
# there 1 is contribution 40 and 10 contribution 1.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

there is 1 contribution of 40 and 10 contributions of 1.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

thx

(40, 0))
# there 1 is contribution 40 and 10 contribution 1.
# total contribution = 1*40+10*1 = 50
# when linf_bound = 0.5, left after contribution bounding 11*0.5=5.5, i.e.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

how linf can be a double and not an integer?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

linf_bound is max contribution per partition, which means

max_contributions_per_partition for COUNT

max_sum_per_partition for SUM (which can be double)

@dvadym dvadym left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for review!

ratio_dropped_linf = self.get_ratio_dropped_linf(linf_bound)
ratio_dropped = 1 - (1 - ratio_dropped_l0) * (1 - ratio_dropped_linf)
stddev = self._get_stddev(l0_bound, linf_bound)
if to_print:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, thanks. Removed

delta: Optional[float] = None,
):
return histogram_error_estimator.create_error_estimator(
return histogram_error_estimator.create_estimator_for_count_privacy_id_count(

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

thx, done


@parameterized.parameters((0, 1), (0.5, 0.89), (1, 0.78), (2, 0.76),
(40, 0))
# there 1 is contribution 40 and 10 contribution 1.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

thx

(40, 0))
# there 1 is contribution 40 and 10 contribution 1.
# total contribution = 1*40+10*1 = 50
# when linf_bound = 0.5, left after contribution bounding 11*0.5=5.5, i.e.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

linf_bound is max contribution per partition, which means

max_contributions_per_partition for COUNT

max_sum_per_partition for SUM (which can be double)

@dvadym
dvadym merged commit 3a7a0ff into OpenMined:main Oct 17, 2024
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.

2 participants