y_pred = np.array([0.21, 0.32, 0.63, 0.35, 0.92, 0.79, 0.82, 0.99, 0.04])
y_true = np.array([0, 1, 0, 0, 1, 1, 0, 1, 0])
print('Original ROC area: {:0.3f}'.format(roc_auc_score(y_true, y_pred)))
n_bootstraps = 1000
rng_seed = 42
bootstrapped_scores = []
rng = np.random.RandomState(rng_seed)
for i in range(n_bootstraps):
    indices = rng.random_integers(0, len(y_pred) - 1, len(y_pred))
if len(np.unique(y_true[indices])) < 2:
    continue
score = roc_auc_score(y_true[indices], y_pred[indices])
bootstrapped_scores.append(score)
print('Bootstrap #{} ROC area: {:0.3f}'.format(i + 1, score))
scikit-learn — кривая ROC с доверительными интервалами