openfl.federated.data
Data package.
- class openfl.federated.data.DataLoader(**kwargs)
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.
- Class Attributes:
None
- get_feature_shape()
Returns the shape of an example feature array.
- Raises:
NotImplementedError – This method must be implemented by a child class.
- get_infer_loader()
Returns the data loader for inferencing data.
- Raises:
NotImplementedError – This method must be implemented by a child class.
- get_train_data_size()
Returns the total number of training samples.
- Raises:
NotImplementedError – This method must be implemented by a child class.
- get_train_loader(**kwargs)
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()
Returns the total number of validation samples.
- Raises:
NotImplementedError – This method must be implemented by a child class.
- get_valid_loader()
Returns the data loader for the validation data.
- Raises:
NotImplementedError – This method must be implemented by a child class.
- class openfl.federated.data.catch_warnings(*, record=False, module=None)
A context manager that copies and restores the warnings filter upon exiting the context.
The ‘record’ argument specifies whether warnings should be captured by a custom implementation of warnings.showwarning() and be appended to a list returned by the context manager. Otherwise None is returned by the context manager. The objects appended to the list are arguments whose attributes mirror the arguments to showwarning().
The ‘module’ argument is to specify an alternative module to the module named ‘warnings’ and imported under that name. This argument is only useful when testing the warnings module itself.
- openfl.federated.data.simplefilter(action, category=<class 'Warning'>, lineno=0, append=False)
Insert a simple entry into the list of warnings filters (at the front).
A simple filter matches all modules and messages. ‘action’ – one of “error”, “ignore”, “always”, “default”, “module”,
or “once”
‘category’ – a class that the warning must be a subclass of ‘lineno’ – an integer line number, 0 matches all warnings ‘append’ – if true, append to the list of filters
|
FederatedDataset module. |
|
DataLoader module. |
|
PyTorchDataLoader module. |
|
KerasDataLoader module. |
|
PyTorchDataLoader module. |
|
TensorflowDataLoader module. |