Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HParams KerasCallback Display Max Value for Metric #3755

Open
dgrahn opened this issue Jun 24, 2020 · 5 comments
Open

HParams KerasCallback Display Max Value for Metric #3755

dgrahn opened this issue Jun 24, 2020 · 5 comments

Comments

@dgrahn
Copy link
Contributor

dgrahn commented Jun 24, 2020

In the HParams plugin, it would be very useful to have the option of viewing the maximum reached by a metric during training. With the current KerasCallback, only the last value is stored. If you use the KerasCallback in addition to EarlyStopping, you'll end up with a lower than max value.

I'd be open to contributing to this, but I would need guidance on where the best place to add the feature would be and how to test it.

@stephanwlee
Copy link
Contributor

Thanks for the feature request and willingness to contribute. Keras callback, specifically, is not owned by us but rather by the TensorFlow team. We can, too, suggest an improvement but if you were to contribute, you would have to send a PR to https://github.com/tensorflow/tensorflow and make changes to https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/keras/callbacks.py.

BTW, @wchargin, do we only record single metric value?

@dgrahn
Copy link
Contributor Author

dgrahn commented Jun 24, 2020

@stephanwlee I believe you are incorrect. The code for the KerasCallback is a part of the Hparams Tensorboard plugin: https://github.com/tensorflow/tensorboard/blob/master/tensorboard/plugins/hparams/keras.py

@dgrahn
Copy link
Contributor Author

dgrahn commented Jun 24, 2020

As I'm looking through the code, I think this is how it works.

  • Tensorboard callback logs metrics.
  • KerasCallback logs the hyperparameters.
  • HParams backend pulls the metrics in from the Tensorboard logs.

Based on this, the best way to handle this would be to add an option inside of the "Metrics" panel to allow users to select which metric is returned (last, max, or min). I believe I could make the changes, but would like them to be "generally approved" before taking the time.

It appears that the relevant code is here:

@stephanwlee
Copy link
Contributor

Ah, indeed. I am very mistaken. Those place look correct, but I would not recommend making changes to the hparams UI code as it is not something we'd like to move forward with. Though it is very early to share, we are working on rewrite in Angular.

@GalOshri did you hear similar feature requests from other users?

@dgrahn
Copy link
Contributor Author

dgrahn commented Jun 26, 2020

So this isn't a great solution since it clutters up the metrics. But I created a callback which logs the maximum value of metrics. It's a stopgap measure for those who need something short-term.

https://gist.github.com/dgrahn/45acc8ee54c515d6ac28e2696db2a12d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants