与TensorFlowDNNClassier相比,DNNClassier是否不稳定?

与TensorFlowDNNClassier相比,DNNClassier是否不稳定?,tensorflow,deep-learning,skflow,Tensorflow,Deep Learning,Skflow,我正在基于skflow和TF v0.9构建DNN预测(0或1)模型。 我使用TensorFlowdnClassifier的代码如下所示。我训练了26000条记录,测试了6500条 classifier = learn.TensorFlowDNNClassifier(hidden_units=[64, 128, 64], n_classes=2) classifier.fit(features, labels, steps=50000) test_pred = classifier.predict

我正在基于skflow和TF v0.9构建DNN预测(0或1)模型。 我使用TensorFlowdnClassifier的代码如下所示。我训练了26000条记录,测试了6500条

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是否不稳定?

我给出了与之相同的答案。您可能会遇到这种情况,因为您使用了steps参数而不是max\u steps。实际上,只有在TensorFlowDNNClassier上的步骤才完成了max_步骤。现在,您可以决定在您的案例中是真的需要50000个步骤还是更早地自动中止。

我给出了与您相同的答案。您可能会遇到这种情况,因为您使用了steps参数而不是max\u steps。实际上,只有在TensorFlowDNNClassier上的步骤才完成了max_步骤。现在,您可以决定在您的案例中是真的需要50000个步骤还是更早地自动中止