Class - DataLoader#

class openfl.federated.data.loader.DataLoader(**kwargs)[source]#

Bases: object

A base class used to represent a Federated Learning Data Loader.

This class should be inherited by any data loader class specific to a machine learning framework.

None#
__init__(**kwargs)[source]#

Initializes the DataLoader object.

Parameters:

kwargs – Additional arguments to pass to the function.

Methods

__init__(**kwargs)

Initializes the DataLoader object.

get_feature_shape()

Returns the shape of an example feature array.

get_infer_loader()

Returns the data loader for inferencing data.

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]#

Returns the shape of an example feature array.

Raises:

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

get_infer_loader()[source]#

Returns the data loader for inferencing data.

Raises:

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

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.