(fpr, tpr, thresholds, auc, save_path)
thresholds from hight to low
thresholds from hight to low
thresholds from hight to low
def plot_roc(fpr, tpr, thresholds, auc, save_path):
  ''' thresholds from hight to low '''
  plt.figure()
  plt.plot(
      fpr, tpr, color='darkorange', lw=2, label='ROC curve (area= %0.2f)' % auc)
  plt.plot([0, 1], [0, 1], color='navy', lw=2, linestyle='--')
  plt.xlim([0.0, 1.0])
  plt.ylim([0.0, 1.05])
  plt.xlabel('False Positive Rate')
  plt.ylabel('True Positive Rate')
  plt.title('Receiver Operating Characteristic')
  plt.legend(loc='lower right')

  # create the axis of thresholds (scores)
  ax2 = plt.gca().twinx()
  ax2.plot(fpr, thresholds, markeredgecolor='r', linestyle='dashed', color='r')
  ax2.set_ylabel('Threshold', color='r')
  ax2.set_ylim([thresholds[-1], thresholds[0]])
  ax2.set_xlim([fpr[0], fpr[-1]])
  plt.savefig(save_path)
  plt.close()
def plot_roc ( fpr , tpr , thresholds , auc , save_path ) : plt . figure ( ) plt . plot ( fpr , tpr , color = 'darkorange' , lw = 2 , label = 'ROC curve (area= %0.2f)' % auc ) plt . plot ( [ 0 , 1 ] , [ 0 , 1 ] , color = 'navy' , lw = 2 , linestyle = '--' ) plt . xlim ( [ 0.0 , 1.0 ] ) plt . ylim ( [ 0.0 , 1.05 ] ) plt . xlabel ( 'False Positive Rate' ) plt . ylabel ( 'True Positive Rate' ) plt . title ( 'Receiver Operating Characteristic' ) plt . legend ( loc = 'lower right' ) # create the axis of thresholds (scores) ax2 = plt . gca ( ) . twinx ( ) ax2 . plot ( fpr , thresholds , markeredgecolor = 'r' , linestyle = 'dashed' , color = 'r' ) ax2 . set_ylabel ( 'Threshold' , color = 'r' ) ax2 . set_ylim ( [ thresholds [ - 1 ] , thresholds [ 0 ] ] ) ax2 . set_xlim ( [ fpr [ 0 ] , fpr [ - 1 ] ] ) plt . savefig ( save_path ) plt . close ( )