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 anExperiment
. It should accept an argumentrun_config
which should be used to create theEstimator
( passed asconfig
to its constructor), and an argumenthparams
, which should be used for hyper-parameters tuning. It must return anExperiment
. -
tuner
: ATuner
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