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

refactor(datasets) Rename SizePartitioner to IdToSizeFncPartitioner #4109

Merged
merged 9 commits into from
Sep 11, 2024
4 changes: 2 additions & 2 deletions datasets/flwr_datasets/partitioner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,28 @@
from .distribution_partitioner import DistributionPartitioner
from .exponential_partitioner import ExponentialPartitioner
from .grouped_natural_id_partitioner import GroupedNaturalIdPartitioner
from .id_to_size_fnc_partitioner import IdToSizeFncPartitioner
from .iid_partitioner import IidPartitioner
from .inner_dirichlet_partitioner import InnerDirichletPartitioner
from .linear_partitioner import LinearPartitioner
from .natural_id_partitioner import NaturalIdPartitioner
from .partitioner import Partitioner
from .pathological_partitioner import PathologicalPartitioner
from .shard_partitioner import ShardPartitioner
from .size_partitioner import SizePartitioner
from .square_partitioner import SquarePartitioner

__all__ = [
"DirichletPartitioner",
"DistributionPartitioner",
"ExponentialPartitioner",
"GroupedNaturalIdPartitioner",
"IdToSizeFncPartitioner",
"IidPartitioner",
"InnerDirichletPartitioner",
"LinearPartitioner",
"NaturalIdPartitioner",
"Partitioner",
"PathologicalPartitioner",
"ShardPartitioner",
"SizePartitioner",
"SquarePartitioner",
]
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

import numpy as np

from flwr_datasets.partitioner.size_partitioner import SizePartitioner
from flwr_datasets.partitioner.id_to_size_fnc_partitioner import IdToSizeFncPartitioner


class ExponentialPartitioner(SizePartitioner):
class ExponentialPartitioner(IdToSizeFncPartitioner):
"""Partitioner creates partitions of size that are correlated with exp(id).

The amount of data each client gets is correlated with the exponent of partition ID.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""SizePartitioner class."""
"""IdToSizeFncPartitioner class."""


from typing import Callable, Dict, List, Union
Expand All @@ -23,7 +23,7 @@
from flwr_datasets.partitioner.partitioner import Partitioner


class SizePartitioner(Partitioner):
class IdToSizeFncPartitioner(Partitioner):
"""Base class for the deterministic size partitioning based on the `partition_id`.

The client with `partition_id` has the following relationship regarding the number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""SizePartitioner tests."""
"""IdToSizeFuncitonPartitioner tests."""


import unittest
Expand Down
4 changes: 2 additions & 2 deletions datasets/flwr_datasets/partitioner/linear_partitioner.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"""LinearPartitioner class."""


from flwr_datasets.partitioner.size_partitioner import SizePartitioner
from flwr_datasets.partitioner.id_to_size_fnc_partitioner import IdToSizeFncPartitioner


class LinearPartitioner(SizePartitioner):
class LinearPartitioner(IdToSizeFncPartitioner):
"""Partitioner creates partitions of size that are linearly correlated with id.

The amount of data each client gets is linearly correlated with the partition ID.
Expand Down
4 changes: 2 additions & 2 deletions datasets/flwr_datasets/partitioner/square_partitioner.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

import numpy as np

from flwr_datasets.partitioner.size_partitioner import SizePartitioner
from flwr_datasets.partitioner.id_to_size_fnc_partitioner import IdToSizeFncPartitioner


class SquarePartitioner(SizePartitioner):
class SquarePartitioner(IdToSizeFncPartitioner):
"""Partitioner creates partitions of size that are correlated with squared id.

The amount of data each client gets is correlated with the squared partition ID.
Expand Down