Skip to content
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

Remove not needed validation on privacy_id_extractor #499

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions examples/movie_view_ratings/run_all_frameworks.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ def calc_dp_rating_metrics(movie_views, backend, public_partitions):
# element of movie view collection.
data_extractors = pipeline_dp.DataExtractors(
partition_extractor=lambda mv: mv.movie_id,
privacy_id_extractor=(lambda mv: mv.user_id)
if not FLAGS.contribution_bounds_already_enforced else None,
privacy_id_extractor=lambda mv: mv.user_id,
value_extractor=value_extractor)

# Run aggregation.
Expand Down
4 changes: 0 additions & 4 deletions pipeline_dp/dp_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,6 @@ def _check_aggregate_params(self,
if check_data_extractors:
_check_data_extractors(data_extractors)
if params.contribution_bounds_already_enforced:
if data_extractors.privacy_id_extractor:
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be possible to log a warning? Clients might have an incorrect configuration in this case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'd say that having privacy_id_extractor is a correct configuration, even if no contribution bounding happens, e.g. in principle it would allow to compute PRIVACY_ID_COUNT per partition. So let's keep w/o warnings.

raise ValueError(
"privacy_id_extractor should be set iff "
"contribution_bounds_already_enforced is False")
if pipeline_dp.Metrics.PRIVACY_ID_COUNT in params.metrics:
raise ValueError(
"PRIVACY_ID_COUNT cannot be computed when "
Expand Down
Loading