question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hparams with Estimators

See original GitHub issue

System information

  • TensorFlow and Tensorboard version (you are using): 2.1.0
  • Are you willing to contribute it (Yes/No): Yes

Describe the feature and the current behavior/state. Hparams cannot be used with estimators in tensorflow 2. There’s a KerasCallback class that logs the hparams when using Keras model.fit, however this is not usable when using Estimator API.

There could be a feature in the form of a callback or hook that can be attached to estimators (with TrainSpec or EvalSpec) which will log hparams metrics against the hparams for the current trial.

Who will benefit with this feature? Those who rely on Estimator API and tensorboard will benefit.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

1reaction
saravanabalagicommented, Feb 8, 2020

The culprit seems to be

# This doesn't seem to compatible with Estimator API
hp.hparams_config(hparams=hparams_list, metrics=metrics_to_monitor)

At the moment, I guess it’s not possible to do use hparam_config(...) with Estimator API. Here’s a workaround until it becomes compatible.

Simply call hparams logs all metrics logged with tf.summary. Then in tensorflow, you can filter only the metrics you need and then compare trials.

with tf.summary.create_file_writer(train_folder).as_default():
    # params is a dict which contains
    # { 'learning_rate': 0.001, 'distance_margin': 0.5,...}
    hp.hparams(hparams=params))
0reactions
saravanabalagicommented, May 27, 2020

@jarednielsen yes, it automatically logged the metrics whichever I logged using summary. So if you didn’t have summary.scalar, you may not see anything.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I use hparams with estimators? - Stack Overflow
Simply calling hparams logs all metrics logged with tf.summary . Then in tensorboard, you can filter only the metrics you need and then...
Read more >
Hyperparameter Tuning with the HParams Dashboard
The HParams dashboard in TensorBoard provides several tools to help with this process of identifying the best experiment or most promising sets ...
Read more >
How To Use Hparams With Estimators - ADocLib
The search is performed using socalled Keras models via the TensorFlow tf. e would be used to find the best parameters for refitting...
Read more >
Use HParams and YAML to Better Manage Hyperparameters ...
A HParams object holds hyperparameters used to build and train a model, ... If you are using Estimator API in Tensorflow 1.4, then...
Read more >
model selection - Nested cross-validation: different hparams for ...
Suppose I have a dataset and two estimators, each with different hyperparameters. I want to select the best estimator and make sure it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found