blazefl.core.PartitionedDataset#

class blazefl.core.PartitionedDataset[source]#

Bases: ABC

Abstract base class for partitioned datasets in federated learning.

This class defines the interface for managing datasets that are partitioned across multiple clients.

Raises:

NotImplementedError – If the methods are not implemented in a subclass.

__init__()#

Methods

__init__()

get_dataloader(type_, cid, batch_size)

Retrieve a DataLoader for a specific type, client ID, and batch size.

get_dataset(type_, cid)

Retrieve a dataset for a specific type and client ID.

abstract get_dataloader(type_: str, cid: int | None, batch_size: int | None) DataLoader[source]#

Retrieve a DataLoader for a specific type, client ID, and batch size.

Parameters:
  • type (str) – The type of the dataset.

  • cid (int | None) – The client ID.

  • batch_size (int | None) – The batch size.

Returns:

The DataLoader.

Return type:

DataLoader

abstract get_dataset(type_: str, cid: int | None) Dataset[source]#

Retrieve a dataset for a specific type and client ID.

Parameters:
  • type (str) – The type of the dataset.

  • cid (int | None) – The client ID.

Returns:

The dataset.

Return type:

Dataset