How to plot one graph of ROC curve for 4 separate ML model located in different python notebooks

if we have 4 different notebooks for different ML model results .. and we have to plot one ROC curve graph which shows the ROc of all 4 models. how can we do this

this is my code in every notebook to plot roc

import sklearn.metrics as metrics
# calculate the fpr and tpr for all thresholds of the classification

fpr, tpr, threshold = metrics.roc_curve(y_true1, y_pred1)
roc_auc = metrics.auc(fpr, tpr)

# method I: plt

import matplotlib.pyplot as plt
plt.title('Receiver Operating Characteristic')
plt.plot(fpr, tpr, 'b', label = 'AUC = %0.2f' % roc_auc)
plt.legend(loc = 'lower right')
plt.plot([0, 1], [0, 1],'r--')
plt.xlim([0, 1])
plt.ylim([0, 1])
plt.ylabel('True Positive Rate')
plt.xlabel('False Positive Rate')
plt.show()

Topic roc python machine-learning

Category Data Science


  1. Write all of the points in the ROC curve to a data CVS file, one for each notebook. One column gives the true positive rate (y-axis), while another column gives the false positive rate. A third column should uniquely identify the notebook of origin for this data frame and will be used later for labeling the graph.

  2. Read your CSV files to data frames in a new script, perhaps in a fifth notebook.

  3. Combine those data frames. pd.concat is likely to be your friend.

  4. Plot your four curves, coloring according to the notebook of origin.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.