tests¶
tests.data_preprocessing_test module¶
- class federated.tests.data_preprocessing_test.DataPreprocessorTest(methodName='runTest')¶
Bases:
tensorflow.python.framework.test_util.TensorFlowTestCase
Class for testing the data preprocessing module.
- test_dataset_shapes_centralized()¶
Function that tests function for centralized data preprocessing. It tests whether the shape of the data matches what is expected.
- test_dataset_shapes_federated()¶
Function that tests function for federated data preprocessing. It tests whether the shape of the data matches what is expected.
- test_get_client_dataset_fn()¶
Function that tests get_client_dataset function. Test if batch of clients using this function have near values what is expected.
- test_get_validation_fn()¶
Function for testing the validation dataset function.
- federated.tests.data_preprocessing_test.create_test_dataset(client_id: Optional[int] = None) → tensorflow.python.data.ops.dataset_ops.DatasetV2¶
Function for creating dataset for tests for data preprocessing.
- Args:
client_id (int, optional): ID of a client. Defaults to None.
- Returns:
tf.data.Dataset: The dataset to be used on the tests
- federated.tests.data_preprocessing_test.create_test_model() → tensorflow.python.keras.engine.training.Model¶
Function for creating model for tests for data preprocessing
- Returns:
tf.keras.Model: A model with one unit.
tests.models_test module¶
tests.rfa_test module¶
- class federated.tests.rfa_test.RFATest(methodName='runTest')¶
Bases:
tensorflow.python.framework.test_util.TensorFlowTestCase
Class for testing RFA.
- create_model() → tensorflow.python.keras.engine.training.Model¶
Creates model for RFA tests.
- Returns:
tf.keras.Model: Model.
- get_test_data() → tensorflow.python.data.ops.dataset_ops.DatasetV2¶
Creates data for RFA tests.
- Returns:
tf.data.Dataset: Dataset.
- test_rfa()¶
Function for testing RFA.
tests.training_loops_test module¶
- class federated.tests.training_loops_test.CentralizedTrainingLoopTest(methodName='runTest')¶
Bases:
tensorflow.python.framework.test_util.TensorFlowTestCase
Class for testing centralized training loop.
- create_test_dataset() → tensorflow.python.data.ops.dataset_ops.DatasetV2¶
Creates data for CL tests.
- Returns:
tf.data.Dataset: Dataset.
- create_test_model() → tensorflow.python.keras.engine.training.Model¶
Creates model for CL tests.
- Returns:
tf.keras.Model: Model.
- test_reduces_loss()¶
Test for checking if the CL loop reduces loss.
- test_write_metrics()¶
Tests if CL loop writes metrics correctly to TensorBoard
- class federated.tests.training_loops_test.FederatedTrainingLoopTest(methodName='runTest')¶
Bases:
tensorflow.python.framework.test_util.TensorFlowTestCase
Class for testing federated learning loop.
- TYPE¶
alias of
federated.tests.training_loops_test.B
- create_tff_model() → federated.tests.training_loops_test.B¶
Function for creating TFF model.
- Returns:
self.TYPE: TFF Model.
- get_batch() → federated.tests.training_loops_test.B¶
Function for getting a batch.
- Returns:
self.TYPE: Batch.
- get_iterative_process()¶
Function for creating Iterative Process.
- Returns:
Iterative Process.
- test_reduces_loss()¶
Test for checking if the FL loop reduces loss.