tff.simulation.datasets.build_synthethic_iid_datasets
Stay organized with collections
Save and categorize content based on your preferences.
Constructs an iterable of IID clients from a tff.simulation.datasets.ClientData
.
tff.simulation.datasets.build_synthethic_iid_datasets(
client_data, client_dataset_size: int, shuffle_buffer_size: int = 10000
)
The returned iterator yields a stream of tf.data.Datsets
that approximates
the true statistical IID setting with the entirety of client_data
representing the global distribution. That is, we do not simply randomly
distribute the data across some fixed number of clients, instead each dataset
returned by the iterator samples independently from the entirety of
client_data
(so any example in client_data
may be produced by any client).
Returns |
A tf.data.Dataset instance that yields iid client datasets sampled from
the global distribution.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-20 UTC.
[null,null,["Last updated 2024-09-20 UTC."],[],[],null,["# tff.simulation.datasets.build_synthethic_iid_datasets\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/federated/blob/v0.87.0 Version 2.0, January 2004 Licensed under the Apache License, Version 2.0 (the) |\n\nConstructs an iterable of IID clients from a [`tff.simulation.datasets.ClientData`](../../../tff/simulation/datasets/ClientData). \n\n tff.simulation.datasets.build_synthethic_iid_datasets(\n client_data, client_dataset_size: int, shuffle_buffer_size: int = 10000\n )\n\nThe returned iterator yields a stream of `tf.data.Datsets` that approximates\nthe true statistical IID setting with the entirety of `client_data`\nrepresenting the global distribution. That is, we do not simply randomly\ndistribute the data across some fixed number of clients, instead each dataset\nreturned by the iterator samples independently from the entirety of\n`client_data` (so any example in `client_data` may be produced by any client).\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-----------------------|-------------------------------------------------------------------------------------------------------------------------------------|\n| `client_data` | A [`tff.simulation.datasets.ClientData`](../../../tff/simulation/datasets/ClientData). |\n| `client_dataset_size` | The size of the [`tf.data.Dataset`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset) to yield from the returned dataset. |\n| `shuffle_buffer_size` | Shuffling buffer size for the union of all data from input `client_data`. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A [`tf.data.Dataset`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset) instance that yields iid client datasets sampled from the global distribution. ||\n\n\u003cbr /\u003e"]]