openfl.interface.interactive_api.experiment.DataInterface

class openfl.interface.interactive_api.experiment.DataInterface(**kwargs)

Bases: object

The class to define dataloaders.

This class is responsible for managing the data loaders in a federated learning experiment.

In the future users will have to adapt unified data interface hook in their dataloaders. For now, we can provide data_path variable on every collaborator node at initialization time for dataloader customization.

Class Attributes:
  • kwargs (dict) – The keyword arguments for the data loaders.

  • shard_descriptor – The shard descriptor for the dataloader.

Methods

get_train_data_size

Information for aggregation.

get_train_loader

Output of this method will be provided to tasks with optimizer in contract.

get_valid_data_size

Information for aggregation.

get_valid_loader

Output of this method will be provided to tasks without optimizer in contract.

Attributes

shard_descriptor

Return shard descriptor.

get_train_data_size()

Information for aggregation.

get_train_loader(**kwargs)

Output of this method will be provided to tasks with optimizer in contract.

get_valid_data_size()

Information for aggregation.

get_valid_loader(**kwargs)

Output of this method will be provided to tasks without optimizer in contract.

property shard_descriptor

Return shard descriptor.

Returns:

The shard descriptor for the data loaders.