【问题标题】:Is DNNClassifier unstable compared with TensorFlowDNNClassifier?DNNClassifier 与 TensorFlowDNNClassifier 相比是否不稳定?
【发布时间】:2016-07-16 16:26:21
【问题描述】:

我正在使用 TF v0.9 构建基于 skflow 的 DNN 预测(0 或 1)模型。 我的TensorFlowDNNClassifier 代码是这样的。我训练了大约 26,000 条记录并测试了 6,500 条记录。

classifier = learn.TensorFlowDNNClassifier(hidden_units=[64, 128, 64], n_classes=2)
classifier.fit(features, labels, steps=50000)
test_pred = classifier.predict(test_features)
print(classification_report(test_labels, test_pred))

大约需要 1 分钟并获得结果。

             precision    recall  f1-score   support
          0       0.77      0.92      0.84      4265
          1       0.75      0.47      0.58      2231
avg / total       0.76      0.76      0.75      6496

但我得到了

WARNING:tensorflow:TensorFlowDNNClassifier class is deprecated. 
Please consider using DNNClassifier as an alternative.

所以我用DNNClassifier 简单地更新了我的代码。

classifier = learn.DNNClassifier(hidden_units=[64, 128, 64], n_classes=2)
classifier.fit(features, labels, steps=50000)

它也很好用。但结果不一样。

             precision    recall  f1-score   support
          0       0.77      0.96      0.86      4265
          1       0.86      0.45      0.59      2231
avg / total       0.80      0.79      0.76      6496

1 的精度提高了。 当然这对我来说是一件好事,但为什么会有所改进呢? 大约需要2个小时。 这比上一个示例慢了大约 120 倍

我有什么问题吗?或错过一些参数? 还是DNNClassifier TF v0.9 不稳定?

【问题讨论】:

    标签: tensorflow deep-learning skflow


    【解决方案1】:

    我给出的答案与here 相同。您可能会遇到这种情况,因为您使用了 steps 参数而不是 ma​​x_steps。它只是 TensorFlowDNNClassifier 上的步骤,实际上做了 max_steps。现在您可以决定是否真的需要 50000 步或提前自动中止。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-30
      • 2017-03-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-25
      • 1970-01-01
      相关资源
      最近更新 更多