Each client of the base_client_data is "expanded" into some number of
pseudo-clients. A serializable function fn(x) maps datapoint x to a new
datapoint, where the constructor of fn is parameterized by the expanded
client_id. For example if the client_id "client_A" has two expansions,
"client_A-0" and "client_A-1" then make_transform_fn("client_A-0")(x) might be
the identity, while make_transform_fn("client_A-1")(x) could be a random
rotation of the image with the angle determined by a hash of the string
A ClientData to expand.
A function to be called as
make_transform_fn(client_id), where client_id is the expanded client
id, which should return a function transform_fn that maps a datapoint
x whose element type structure correspondes to base_client_data to a
new datapoint x'. It must be traceable as a tf.function.
An optional function that maps a client id of
base_client_data to a list of expanded client ids. If None, the
transformed data will have the same size and ids as the original.
An function that maps an expanded client id back to the
raw client id. Must be traceable as a tf.function. Must be specified
if and only if expand_client_id is.
A list of string identifiers for clients in this dataset.
This method partitions the clients of client_data into two ClientData
objects with disjoint sets of ClientData.client_ids. All clients in the
test ClientData are guaranteed to have non-empty datasets, but the
training ClientData may have clients with no data.
The base ClientData to split.
How many clients to hold out for testing. This can be at
most len(client_data.client_ids) - 1, since we don't want to produce
Optional seed to fix shuffling of clients before splitting. The seed
can be any nonnegative 32-bit integer, an array of such integers, or
A pair (train_client_data, test_client_data), where test_client_data
has num_test_clients selected at random, subject to the constraint they
each have at least 1 batch in their dataset.
If num_test_clients cannot be satistifed by client_data,
or too many clients have empty datasets.