roc_auc_score - Only one class present in y_true : <p>I am doing a k-fold XV on an existing dataframe, and I need to get the AUC score.
The problem is - sometimes the test data only contains 0s, and not 1s!</p>

<p>I tried using <a href="http://scikit-learn.org/stable/modules/generated/sklearn.metrics.roc_auc_score.html" rel="noreferrer">this</a> example, but with different numbers:</p>

<pre><code>import numpy as np
from sklearn.metrics import roc_auc_score
y_true = np.array([0, 0, 0, 0])
y_scores = np.array([1, 0, 0, 0])
roc_auc_score(y_true, y_scores)
</code></pre>

<p>And I get this exception:</p>

<blockquote>
  <p>ValueError: Only one class present in y_true. ROC AUC score is not
  defined in that case.</p>
</blockquote>

<p>Is there any workaround that can make it work in such cases?</p>
