pROC ROC curves remove empty space

Make sure the plotting device is square and adjust the margins so that top + bottom == left + right: library(pROC) png(“test.png”, width = 480, height = 480) par(mar = c(4, 4, 4, 4)+.1) n = c(4, 3, 5) b = c(TRUE, FALSE, TRUE) rocobj <- plot.roc(b, n, percent = TRUE, main=”ROC”, col=”#1c61b6″, add=FALSE) dev.off()

How to plot ROC curve in Python

Here are two ways you may try, assuming your model is an sklearn predictor: import sklearn.metrics as metrics # calculate the fpr and tpr for all thresholds of the classification probs = model.predict_proba(X_test) preds = probs[:,1] fpr, tpr, threshold = metrics.roc_curve(y_test, preds) roc_auc = metrics.auc(fpr, tpr) # method I: plt import matplotlib.pyplot as plt plt.title(‘Receiver … Read more

ROC for multiclass classification

As people mentioned in comments you have to convert your problem into binary by using OneVsAll approach, so you’ll have n_class number of ROC curves. A simple example: from sklearn.metrics import roc_curve, auc from sklearn import datasets from sklearn.multiclass import OneVsRestClassifier from sklearn.svm import LinearSVC from sklearn.preprocessing import label_binarize from sklearn.model_selection import train_test_split import matplotlib.pyplot … Read more