title: How to make sklearn.metrics.confusion_matrix() to always return TP, TN, FP, FN?
body: <p>I am using <strong><code>sklearn.metrics.confusion_matrix(y_actual, y_predict)</code></strong> to extract tn, fp, fn, tp and most of the time it works perfectly.</p>
  
  <pre><code>from sklearn.metrics import confusion_matrix
  
  y_actual, y_predict = [1,1,1,1], [0,0,0,0]
  tn, fp, fn, tp = confusion_matrix(y_actual, y_predict).ravel()
  &gt;&gt;&gt; [0 0 4 0]   # ok
  
  y_actual, y_predict = [1,1,1,1],[0,1,0,1]
  tn, fp, fn, tp = confusion_matrix(y_actual, y_predict).ravel()
  &gt;&gt;&gt; [0 0 2 2]   # ok
  </code></pre>
  
  <p>However, in some cases the confusion_matrix() doesn't always return those info and I would get ValueError as shown below.</p>
  
  <pre><code>from sklearn.metrics import confusion_matrix
  
  y_actual, y_predict = [0,0,0,0],[0,0,0,0]
  tn, fp, fn, tp = confusion_matrix(y_actual, y_predict).ravel()
  &gt;&gt;&gt; [4]    # ValueError: not enough values to unpack (expected 4, got 1)
  
  y_actual, y_predict = [1,1,1,1],[1,1,1,1]
  tn, fp, fn, tp = confusion_matrix(y_actual, y_predict).ravel()
  &gt;&gt;&gt; [4]    # ValueError: not enough values to unpack (expected 4, got 1)
  </code></pre>
  
  <p>My temporary solution is to write my own function to extract those info. Is there any way I can force the <strong><code>confusion_matrix()</code></strong> to always return the tn, fp, fn, tp output?</p>
  
  <p>Thanks</p>