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

Sum per partition histogram #512

Merged
merged 7 commits into from
Dec 4, 2023
Merged

Sum per partition histogram #512

merged 7 commits into from
Dec 4, 2023

Conversation

dvadym
Copy link
Collaborator

@dvadym dvadym commented Dec 1, 2023

Computing histogram for sum per partition (i.e. of non-dp sum per partition). Its computation similar to linf_sum_contributions_histogram: i.e. the range between min/max split on 10^4 bins and count/sum/max for each bin is computed.

@dvadym dvadym requested a review from RamSaw December 1, 2023 14:53
Copy link
Collaborator

@RamSaw RamSaw left a comment

Choose a reason for hiding this comment

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

LGTM, only nits :)

"map to lowers")
def generate_lowers(min_max: Tuple[float, float]) -> List[float]:
min_, max_ = min_max
if min_ == max_:
Copy link
Collaborator

Choose a reason for hiding this comment

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

will it generate min_ number_of_buckets + 1 times otherweise?

pipeline_dp/dataset_histograms/computing_histograms.py Outdated Show resolved Hide resolved
pipeline_dp/dataset_histograms/computing_histograms.py Outdated Show resolved Hide resolved
@@ -185,7 +185,8 @@ def test_find_candidate_parameters_count(self, max_value, max_candidates,
mock_l0_histogram.max_value = mock.Mock(return_value=max_value)

mock_histograms = histograms.DatasetHistograms(mock_l0_histogram, None,
None, None, None, None)
None, None, None, None,
None)
Copy link
Collaborator

Choose a reason for hiding this comment

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

weird formatting but maybe that's what the tool generates

tests/dataset_histograms/computing_histograms_test.py Outdated Show resolved Hide resolved
tests/dataset_histograms/computing_histograms_test.py Outdated Show resolved Hide resolved
sum=-10.0,
max=-1.0),
hist.FrequencyBin(lower=0.0,
upper=0.00019999999999997797,
Copy link
Collaborator

Choose a reason for hiding this comment

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

hm, so this value we have here due to imprecise math, should then try to assert with an interval around 0.0002? But I guess then assertion will be more complicated because we won't be able to assert just like assert(actual == expected).

@dvadym dvadym merged commit 39917cd into OpenMined:main Dec 4, 2023
10 of 14 checks passed
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.

None yet

2 participants