-
Notifications
You must be signed in to change notification settings - Fork 942
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
feat(datasets) Add DistributionPartitioner
to Flower Datasets
#3791
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
datasets/flwr_datasets/partitioner/distribution_partitioner_test.py
Outdated
Show resolved
Hide resolved
adam-narozniak
previously approved these changes
Jul 22, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
jafermarq
reviewed
Jul 22, 2024
jafermarq
reviewed
Jul 22, 2024
jafermarq
reviewed
Jul 23, 2024
jafermarq
approved these changes
Jul 24, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
Some FL researchers use specific NIID distributions such as a pathological power law split but Flower Datasets do not currently support such partitioning schemes.
Description
The power law splitting procedure are used in several notable research such as
fedprox
andtamuna
. To ensure that Flower Datasets can be used with Flower baselines, this partitioner needs to be developed.Related issues/PRs
Proposal
Add a partitioner that closely reproduce the power-law partitioning scheme.
Explanation
This partitioner will include the functionalities to:
Point 1 is intentional so that other distributions (other than a log-normal distribution) can also be flexibly prescribed to this partitioning scheme. It retains its original pathological definition, i.e. partitions only have
num_unique_labels_per_partition
. All samples from the dataset are exhausted during sampling, if therescale
parameter is set toTrue
.This implementation is inspired from Li et al. "Federated Optimization in Heterogeneous Networks" (2020) https://arxiv.org/abs/1812.06127.
Visualizations
The histogram shows the pathological partitioning of a log-normal distribution for 20 partitions with the MNIST dataset, with 5 preassigned number of samples per label, and 2 unique labels per partition:

To assess the original power law implementation by Li et al. and the Flower Datasets implementation, we plot and compare the distributions from both implementation below:

$y=x^{-2}$ curve, which validates our implementation.
The plot above uses the original configuration of 1_000 partitions, 5 preassigned number of samples per label, and 2 unique labels per partition. Our Flower Datasets implementation closely matches the original distribution and the
Checklist
#contributions
)Any other comments?