machine-learning - TensorFlow 中 tf.estimator.Estimator 和 tf.contrib.learn.Estimator 有什么区别

标签 machine-learning tensorflow

几个月前,我使用了tf.contrib.learn.DNNRegressor来自 TensorFlow 的 API,我发现它使用起来非常方便。最近几个月我没有跟上TensorFlow的发展。现在我有一个项目,我想再次使用回归器,但可以更好地控制 DNNRegressor 提供的实际模型。 。据我所知,Estimator 支持这一点。 API 使用model_fn参数。

但是有两个Estimator TensorFlow API 中的:

  • tf.contrib.learn.Estimator
  • tf.estimator.Estimator

两者都提供类似的 API,但用法略有不同。为什么有两种不同的实现?有理由选择其中一种吗?

不幸的是,我在 TensorFlow 文档或何时使用两者的指南中找不到任何差异。实际上,学习 TensorFlow 教程会产生很多警告,因为某些接口(interface)显然已更改(而不是 xy 参数、input_fn 参数等)。

最佳答案

我也有同样的疑问,但无法给出明确的答案,但是我有一些有根据的猜测可能会对您有所帮助:

似乎 tf.estimator.Estimator 以及返回 tf.estimator.EstimatorSpec 的模型函数是较新示例中使用的最新函数,并且将在新代码中使用的代码。

我现在的猜测是,tf.contrib.learn.Estimator 是一个早期原型(prototype),已被 tf.estimator.Estimator 取代。根据文档,tf.contrib 中的所有内容都是不稳定的 API,可能随时更改,并且看起来 tf.estimator 模块是从“进化”而来的稳定 API tf.contrib.learn 模块。我认为作者只是忘记将 tf.contrib.learn.Estimator 标记为已弃用,并且尚未删除,因此现有代码不会中断。

关于machine-learning - TensorFlow 中 tf.estimator.Estimator 和 tf.contrib.learn.Estimator 有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44204897/

相关文章:

Hadoop机器学习/数据挖掘项目构想?

python-3.x - 如何在 keras 模型中可视化学习到的训练权重?

tensorflow - 使用GOOGLE COLAB TPU在IMAGENET上训练VGG-16模型需要多长时间?

object - 如何在没有 nms 的情况下从 Tensorflow 对象检测 ssd-mobilenet 解码 raw_outputs/box_encodings

linux - ImportError:/lib64/libc.so.6: 版本 `GLIBC_2.17' 在 RHEL 6.9 上导入 tensorflow 时找不到(圣地亚哥)

python - 使用 matplotlib 在 Python 中绘制颜色不匹配的相关图

machine-learning - 如何使用 Weka 中的新训练数据更新训练模型 (weka.classifiers.functions.MultilayerPerceptron)?

string - 机器学习根据字符串相似度将字符串预处理为数字

machine-learning - 高偏差或方差? - SVM 和奇怪的学习曲线

python - 当变量具有 validate_shape=False 时,Tensorflow AdamOptimizer 会抛出错误