python - 在 TensorFlow 中使用实验的优势

标签 python tensorflow machine-learning deep-learning tensorflow-estimator

许多 TensorFlow 的示例应用程序创建 Experiment s 并运行 Experiment 之一通过调用 tf.contrib.data.learn_runner.run 的方法.它看起来像一个 Experiment本质上是 Estimator 的包装器.

创建和运行 Experiment 所需的代码看起来比创建、训练和评估 Estimator 所需的代码更复杂.我确信使用 Experiment 有好处s,但我不知道它是什么。有人可以帮我吗?

最佳答案

tf.contrib.learn.Experiment 是用于分布式训练的高级 API。这是来自它的文档:

Experiment is a class containing all information needed to train a model.

After an experiment is created (by passing an Estimator and inputs for training and evaluation), an Experiment instance knows how to invoke training and eval loops in a sensible fashion for distributed training.

就像 tf.estimator.Estimator(和派生类)是隐藏矩阵乘法、保存检查点等的高级 API 一样,tf.contrib.learn.Experiment 试图隐藏您的样板文件d 需要为 distributed computation 做,即 tf.train.ClusterSpectf.train.Server、jobs、tasks 等

您可以在没有实验的单台机器上训练和评估tf.estimator.Estimator。请参阅 this tutorial 中的示例。

关于python - 在 TensorFlow 中使用实验的优势,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47277279/

相关文章:

javascript - 有什么方法可以从 HTML 文档中删除 javascript 代码吗?

python - 如何根据列映射减去两个数据帧?

python - 使用参数时 flask 中的 url_for

python - 将 python 字典写入 CSV 列 : keys to first column, 值到第二个

tensorflow - 在序列模型中使用填充时,Keras 验证准确性是否有效/可靠?

c++ - 检查失败 : 1 == NumElements() (1 vs. 1792)在 Tensorflow C++ 中必须有一个元素张量

python - keras预测在多分类中总是输出相同的值

tensorflow - Keras 使用经过训练的 InceptionV3 模型 + CIFAR10 出现有关 Batch Size 的错误

python - 为什么不显示 val_loss 和 val_acc?

tensorflow - 用于 ML 预测的 Celery 任务在执行中挂起