我正在尝试从tensorflow提供的CIFAR-10示例的修改版本中绘制ROC曲线。现在它是针对2个类而不是10个类。
网络的输出称为logits,其形式如下:
[[-2.57313061 2.57966399] [ 0.04221377 -0.04033273] [-1.42880082 1.43337202] [-2.7692945 2.78173304] [-2.48195744 2.49331546] [ 2.0941515 -2.10268974] [-3.51670194 3.53267646] [-2.74760485 2.75617766] ...]
首先,这些logits实际上代表什么?网络中的最后一层是具有WX+b形式的“softmax linear”。
该模型能够通过调用计算准确度。
然后一旦图表被初始化:
网络的输出称为logits,其形式如下:
[[-2.57313061 2.57966399] [ 0.04221377 -0.04033273] [-1.42880082 1.43337202] [-2.7692945 2.78173304] [-2.48195744 2.49331546] [ 2.0941515 -2.10268974] [-3.51670194 3.53267646] [-2.74760485 2.75617766] ...]
首先,这些logits实际上代表什么?网络中的最后一层是具有WX+b形式的“softmax linear”。
该模型能够通过调用计算准确度。
top_k_op = tf.nn.in_top_k(logits, labels, 1)
然后一旦图表被初始化:
predictions = sess.run([top_k_op])
predictions_int = np.array(predictions).astype(int)
true_count += np.sum(predictions)
...
precision = true_count / total_sample_count
这个工作得很好。
但现在我该如何从这里绘制一个ROC曲线呢?
我一直在尝试使用"sklearn.metrics.roc_curve()"函数(http://scikit-learn.org/stable/modules/generated/sklearn.metrics.roc_curve.html#sklearn.metrics.roc_curve),但我不知道该使用什么作为我的"y_score"参数。
非常感谢任何帮助!