def plot_multiclass_roc(y_true, y_pred, classes, path, name):
    n_classes = len(classes)
    lw = 1
    items = []
    labels = ['item_id', 'fpr', 'tpr', 'roc_auc']
    for i in range(n_classes):
        (fpr, tpr, _) = roc_curve(y_true[:, i], y_pred[:, i])
        roc_auc = auc(fpr, tpr)
        items.append((i, fpr, tpr, roc_auc))
    df = pd.DataFrame.from_records(items, columns=labels)
    df = df.sort_values(by=['roc_auc'], ascending=False)
    for (idx, (_, row)) in enumerate(df.iterrows()):
        color = get_color(idx)
        plt.plot(row['fpr'], row['tpr'], lw=lw, color=color, label=f"{classes[row['item_id']]} (area = {row['roc_auc']:.2f})")
    plt.plot([0, 1], [0, 1], 'k--', lw=lw)
    plt.xlim([(- 0.05), 1.0])
    plt.ylim([0.0, 1.05])
    plt.xlabel('False Positive Rate')
    plt.ylabel('True Positive Rate')
    plt.title(f'Receiver operating characteristic for {name}')
    plt.legend(loc='lower right', fancybox=True, shadow=True, ncol=3, prop={'size': 12})
    plt.savefig(f'{path}{name}-roc.png', bbox_inches='tight')
    plt.clf()
    plt.close()
def plot_multiclass_roc(y_true, y_pred, classes, path, name):
    n_classes = len(classes)
    lw = 1
    items = []
    labels = ['item_id', 'fpr', 'tpr', 'roc_auc']
    for i in range(n_classes):
        (fpr, tpr, _) = roc_curve(y_true[:, i], y_pred[:, i])
        roc_auc = auc(fpr, tpr)
        items.append((i, fpr, tpr, roc_auc))
    df = pd.DataFrame.from_records(items, columns=labels)
    df = df.sort_values(by=['roc_auc'], ascending=False)
    for (idx, (_, row)) in enumerate(df.iterrows()):
        color = get_color(idx)
        plt.plot(row['fpr'], row['tpr'], lw=lw, color=color, label=f"{classes[row['item_id']]} (area = {row['roc_auc']:.2f})")
    plt.plot([0, 1], [0, 1], 'k--', lw=lw)
    plt.xlim([(- 0.05), 1.0])
    plt.ylim([0.0, 1.05])
    plt.xlabel('False Positive Rate')
    plt.ylabel('True Positive Rate')
    plt.title(f'Receiver operating characteristic for {name}')
    plt.legend(loc='lower right', fancybox=True, shadow=True, ncol=3, prop={'size': 12})
    plt.savefig(f'{path}{name}-roc.png', bbox_inches='tight')
    plt.clf()
    plt.close()