federated
federated copied to clipboard
Why the code test on only one client ?
Like the code below mention :
def keras_evaluate(state, round_num):
# Take our global model weights and push them back into a Keras model to
# use its standard `.evaluate()` method.
keras_model = load_model(batch_size=BATCH_SIZE)
keras_model.compile(
loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
metrics=[FlattenedCategoricalAccuracy()])
state.model.assign_weights_to(keras_model)
loss, accuracy = keras_model.evaluate(example_dataset, steps=2, verbose=0)
They test on only example_dataset which is the dataset of only a single client.
Why we don't test on the entire test dataset(of all clients) like for example:
test_data = testset.create_tf_dataset_from_all_clients()
Or it's the same idea.
Thanks
@aynesss This looks like a snippet of code extracted from some library. Is this in a tutorial or example? If not, where is this from?
In general you're right that evaluating on the result of create_tf_dataset_from_all_clients
gives a more holistic evaluation, but perhaps this code was just meant as an example?
Marking this as closed due to inactivity.