title: roc_curve from multilabel classification has slope
body: <p>I have a multilabel classifier written in Keras from which I want to compute AUC and plot a ROC curve for every element classified from my test set. </p>
  
  <p><a href="https://i.stack.imgur.com/IUWLe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IUWLe.png" alt="enter image description here"></a></p>
  
  <p>Everything seems fine, except that some elements  have a roc curve that have a slope as follows: </p>
  
  <p><a href="https://i.stack.imgur.com/XCNCA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XCNCA.png" alt="enter image description here"></a></p>
  
  <p>I don't know how to interpret the slope in such cases.</p>
  
  <p>Basically my workflow goes as follows, I have a pre-trained <code>model</code>, instance of Keras, and I have the features <code>X</code> and the binarized labels <code>y</code>, every element in <code>y</code> is an array of length 1000, as it is a multilabel classification problem each element in <code>y</code> might contain many 1s, indicating that the element belongs to multiples classes, so I used the built-in loss of <code>binary_crossentropy</code> and my outputs of the model prediction are score probailities. Then I plot the roc curve as follows.</p>
  
  <pre><code>from sklearn.metrics import roc_curve, auc
  #...
  for xi, yi in (X_test, y_test):
      y_pred = model.predict([xi])[0]
      fpr, tpr, _ = roc_curve(yi, y_pred)
  
      plt.plot(fpr, tpr, color='darkorange', lw=0.5)
  </code></pre>
  
  <p>The predict method returns probabilities, as I'm using the functional api of keras.</p>
  
  <p>Does anyone knows why roc curves looks like this?</p>