How to plot roc curve for custom NN classifier

Hi,

so you should be getting outputs of shape batch_size x 1 from your model. If you loop over your test set and collect them and the labels into two lists as discussed in this thread and concatenate (torch.cat) to get prediction scores and labels for the entire dataset.

You can then either feed the result to SKLearn or do this manually as we did in Chapter 14 or our book by sorting the predictions and then getting tp / fp per threshold with broadcasting (cell 4) and then doing the numerical integration using the trapezoidal rule (cell 5).

Best regards

Thomas

1 Like