I am trying to build a ROC curve from a modified version of the CIFAR-10 example represented by a tensor flow. This is now for 2 classes instead of 10.
The network output is called logits and takes the form:
[[- 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.757766]
First, what are these logits? The last layer on the net is the "softmax linear" form of WX + b.
The model is able to calculate accuracy by calling
top_k_op = tf.nn.in_top_k(logits, labels, 1)
Then, as soon as the chart is initialized:
predictions = sess.run([top_k_op]) predictions_int = np.array(predictions).astype(int) true_count += np.sum(predictions) ... precision = true_count / total_sample_count
This works great.
But now, how can I build a ROC curve from this?
I'm trying to use the sklearn.metrics.roc_curve () function ( http://scikit-learn.org/stable/modules/generated/sklearn.metrics.roc_curve.html#sklearn.metrics.roc_curve ), but I don't know what for use as parameter "y_score".
Any help would be appreciated!
source share