title: True Positive Rate and False Positive Rate (TPR, FPR) for Multi-Class Data in python
body: <p>How do you compute the true- and false- positive rates of a multi-class classification problem? Say,</p>
  
  <pre><code>y_true = [1, -1,  0,  0,  1, -1,  1,  0, -1,  0,  1, -1,  1,  0,  0, -1,  0]
  y_prediction = [-1, -1,  1,  0,  0,  0,  0, -1,  1, -1,  1,  1,  0,  0,  1,  1, -1]
  </code></pre>
  
  <p>The confusion matrix is computed by <code>metrics.confusion_matrix(y_true, y_prediction)</code>, but that just shifts the problem.</p>
  
  <hr>
  
  <p>EDIT after @seralouk's answer. Here, the class <code>-1</code> is to be considered as the negatives, while <code>0</code> and <code>1</code> are variations of positives.</p>