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

Hierarchical accountant #123

Merged
merged 7 commits into from
Nov 29, 2021
Merged

Conversation

sushkoy
Copy link
Collaborator

@sushkoy sushkoy commented Nov 28, 2021

Description

Introducing budget accounting scopes.

The current budget accountant supports proportional budget allocation, where each DP operation can specify some relative “weight” and the budget accountant looks at all operations and distributes the global budget proportionally. This is nice.

However, if an operation contains multiple sub-operations, they all need to be aware of the weight of the parent operation, which needs manual piping of the weight, and multiplying weights of the sub-operations by the parent weight.

Manually ensuring that the sub-operations sum up to the parent weight is error-prone. This change suggests a convenient API that allows to scope DP operations and automatically ensure that the weight of each sub-operation is correctly normalised.

How has this been tested?

A unit test.

Checklist

Copy link
Collaborator

@dvadym dvadym left a comment

Choose a reason for hiding this comment

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

Thanks it looks cool, I left some comments

.gitignore Outdated Show resolved Hide resolved
pipeline_dp/budget_accounting.py Outdated Show resolved Hide resolved
pipeline_dp/budget_accounting.py Outdated Show resolved Hide resolved
pipeline_dp/budget_accounting.py Outdated Show resolved Hide resolved
pipeline_dp/budget_accounting.py Outdated Show resolved Hide resolved
pipeline_dp/aggregate_params.py Show resolved Hide resolved
pipeline_dp/budget_accounting.py Outdated Show resolved Hide resolved
pipeline_dp/budget_accounting.py Outdated Show resolved Hide resolved
pipeline_dp/budget_accounting.py Outdated Show resolved Hide resolved
pipeline_dp/budget_accounting.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@dvadym dvadym left a comment

Choose a reason for hiding this comment

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

It looks good, 1 minor comment and could you please run
make format
linting is failing

@@ -90,7 +90,6 @@ class SumParams:
max_contributions_per_partition: int
low: float
high: float
budget_weight: float
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please return back this as well

@@ -52,6 +52,13 @@ def aggregate(self, col, params: AggregateParams,
"""
if params is None:
return None

with self._budget_accountant.scope(weight=params.budget_weight):
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like an idea to create internal aggregate instead of having with on the entire function!

Copy link
Collaborator Author

@sushkoy sushkoy left a comment

Choose a reason for hiding this comment

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

Is this ready to merge?

@dvadym
Copy link
Collaborator

dvadym commented Nov 29, 2021

Is this ready to merge?

Tests are failing. Please return back budget_weight in SumParams

Copy link
Collaborator

@dvadym dvadym left a comment

Choose a reason for hiding this comment

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

Thanks!

@dvadym dvadym merged commit 46b2dc4 into OpenMined:main Nov 29, 2021
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