tff.simulation.datasets.build_single_label_dataset
Stay organized with collections
Save and categorize content based on your preferences.
Build a new dataset that only yields examples with a particular label.
tff.simulation.datasets.build_single_label_dataset(
dataset, label_key, desired_label
)
This can be used for creating pathological non-iid (in label space) datasets.
Args |
dataset
|
The base tf.data.Dataset that yields examples that are structures
of string key -> tensor value pairs.
|
label_key
|
The str key that holds the label for the example.
|
desired_label
|
The label value to restrict the resulting dataset to.
|
Returns |
A tf.data.Dataset that is composed of only examples that have a label
matching desired_label .
|
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_single_label_dataset\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\nBuild a new dataset that only yields examples with a particular label. \n\n tff.simulation.datasets.build_single_label_dataset(\n dataset, label_key, desired_label\n )\n\nThis can be used for creating pathological non-iid (in label space) datasets.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `dataset` | The base [`tf.data.Dataset`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset) that yields examples that are structures of string key -\\\u003e tensor value pairs. |\n| `label_key` | The `str` key that holds the label for the example. |\n| `desired_label` | The label value to restrict the resulting dataset to. |\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) that is composed of only examples that have a label matching `desired_label`. ||\n\n\u003cbr /\u003e"]]