Class - FlowerDataLoader#

class openfl.federated.data.loader_flower.FlowerDataLoader(data_path, **kwargs)[source]#

Bases: DataLoader

Flower Dataloader

This class extends the OpenFL DataLoader to provide functionality for loading and partitioning data for a Flower workload.

__init__(data_path, **kwargs)[source]#

Initialize the FlowerDataLoader.

Parameters:
  • data_path (str or int) – The directory of the dataset.

  • **kwargs – Additional keyword arguments to pass to the parent DataLoader class.

Raises:

FileNotFoundError – If the specified data path does not exist.

Methods

__init__(data_path, **kwargs)

Initialize the FlowerDataLoader.

get_feature_shape()

Override the parent method to return None.

get_infer_loader()

Returns the data loader for inferencing data.

get_node_configs()

Get the configuration for each node.

get_train_data_size()

Returns the total number of training samples.

get_train_loader(**kwargs)

Returns the data loader for the training data.

get_valid_data_size()

Returns the total number of validation samples.

get_valid_loader()

Returns the data loader for the validation data.

get_feature_shape()[source]#

Override the parent method to return None. Flower’s own infrastructure will handle the feature shape.

get_infer_loader()[source]#

Returns the data loader for inferencing data.

Raises:

NotImplementedError – This method must be implemented by a child class.

get_node_configs()[source]#

Get the configuration for each node.

This method returns the number of partitions and the data shard, which can be used by each node to access the dataset.

Returns:

data path

Return type:

str

get_train_data_size()[source]#

Returns the total number of training samples.

Raises:

NotImplementedError – This method must be implemented by a child class.

get_train_loader(**kwargs)[source]#

Returns the data loader for the training data.

Parameters:

kwargs – Additional arguments to pass to the function.

Raises:

NotImplementedError – This method must be implemented by a child class.

get_valid_data_size()[source]#

Returns the total number of validation samples.

Raises:

NotImplementedError – This method must be implemented by a child class.

get_valid_loader()[source]#

Returns the data loader for the validation data.

Raises:

NotImplementedError – This method must be implemented by a child class.