federated icon indicating copy to clipboard operation
federated copied to clipboard

Why the code test on only one client ?

Open aynesss opened this issue 2 years ago • 1 comments

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 avatar May 13 '22 11:05 aynesss

@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?

zcharles8 avatar May 18 '22 23:05 zcharles8

Marking this as closed due to inactivity.

zcharles8 avatar Aug 19 '22 22:08 zcharles8