Partitioner

class Partitioner[source]

Bases: ABC

The base partitioner class that enables obtaining federated partitions.

The initialization is intended to take all necessary arguments such that the call to the load_partition method can be used in the same way for all partitioners.

Methods

is_dataset_assigned()

Check if a dataset has been assigned to the partitioner.

load_partition(partition_id)

Load a single partition based on the partition index.

Attributes

dataset

Dataset property.

num_partitions

Total number of partitions.

property dataset: Dataset

Dataset property.

is_dataset_assigned() bool[source]

Check if a dataset has been assigned to the partitioner.

This method returns True if a dataset is already set for the partitioner, otherwise, it returns False.

Returns:

dataset_assigned – True if a dataset is assigned, otherwise False.

Return type:

bool

abstract load_partition(partition_id: int) Dataset[source]

Load a single partition based on the partition index.

Parameters:

partition_id (int) – the index that corresponds to the requested partition

Returns:

dataset_partition – single dataset partition

Return type:

Dataset

abstract property num_partitions: int

Total number of partitions.