tensorflow / tensorflow/tensorboard

Tensorboard hparams plugin API reports metrics from final epoch, *not* epoch with best performance on metric tracked via EarlyStopping

Open
#4,630 12 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

core:frontend plugin:hparams type:feature
Dominant language
TypeScript
Stars
7.2k
Forks
1.7k
Avg merge
4d 22h
Merged PRs (30d)
1

Description

System information

  • TensorFlow version: 2.3.0
  • Are you willing to contribute it: Yes, with guidance/help to know where to look

Describe the feature and the current behavior/state.
Feature would change current behavior of Tensorboard. Current behavior is that Tensorboard displays the validation loss from the final epoch of training, which is not useful when comparing different models to each other.

Will this change the current API? How?
This will change tensorboard.plugins.hparams.api to report the performance of the best training epoch, not just the final epoch. Since the purpose of validation is to detect overfitting, this is in line with the reasons for performing it.

Who will benefit with this feature?
Everyone who uses Tensorboard to compare models to each other based on the performance of the best training epoch.

Any Other info.
I am currently using a standard tf.keras.callbacks.Tensorboard instance, sub-classed with the following method as the only modification:

    def on_train_end(self, logs=None):
        if os.path.exists(os.path.join(self.log_dir, "train", "plugins")):
            shutil.rmtree(os.path.join(self.log_dir, "train", "plugins"))

I am also creating a callback with the following code:

from tensorboard.plugins.hparams import api as hp
hp.hparams_config(
    hparams=hparams_list,
    metrics=[hp.Metric(CategoricalAccuracy().name, display_name=CategoricalAccuracy().name)],
)
hp_callback = hp.KerasCallback(writer=output_dir, hparams=session_hparams)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tensorboard.plugins.hparams.api and the KerasCallback setup shown in the report; trace how validation metrics are recorded and selected across epochs. Check how EarlyStopping identifies the best epoch and clarify behavior for metric direction and missing best-epoch data, then verify that the hparams report uses the best-epoch value rather than the final epoch.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
data-visualization, machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.