contrib.learn.learn_runner.tune

tf.contrib.learn.learn_runner.tune

tf.contrib.learn.learn_runner.tune

tune(
    *args,
    **kwargs
)

Defined in tensorflow/contrib/framework/python/framework/experimental.py.

Tune an experiment with hyper-parameters. (experimental)

THIS FUNCTION IS EXPERIMENTAL. It may change or be removed at any time, and without warning.

It iterates trials by running the Experiment for each trial with the corresponding hyper-parameters. For each trial, it retrieves the hyper-parameters from tuner, creates an Experiment by calling experiment_fn, and then reports the measure back to tuner.

Example:

def _create_my_experiment(run_config, hparams):
  hidden_units = [hparams.unit_per_layer] * hparams.num_hidden_layers

  return tf.contrib.learn.Experiment(
      estimator=DNNClassifier(config=run_config, hidden_units=hidden_units),
      train_input_fn=my_train_input,
      eval_input_fn=my_eval_input)

tuner = create_tuner(study_configuration, objective_key)

learn_runner.tune(experiment_fn=_create_my_experiment, tuner)

Args:

  • experiment_fn: A function that creates an Experiment. It should accept an argument run_config which should be used to create the Estimator ( passed as config to its constructor), and an argument hparams, which should be used for hyper-parameters tuning. It must return an Experiment.
  • tuner: A Tuner instance.

© 2017 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/contrib/learn/learn_runner/tune

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部