(precision, recall, thresholds, save_path)
thresholds from low to hight
thresholds from low to hight
thresholds from low to hight
def plot_pr(precision, recall, thresholds, save_path):  # pylint: disable=unused-argument
  ''' thresholds from low to hight '''
  plt.figure()

  plt.step(recall, precision, color='b', alpha=0.2, where='post')
  plt.fill_between(recall, precision, step='post', alpha=0.2, color='b')

  plt.ylim([0.0, 1.05])
  plt.xlim([0.0, 1.0])
  plt.xlabel('Recall')
  plt.ylabel('Precision')
  plt.title('2-class Precision-Recall curve')
  plt.legend(loc='lower right')

  # pylint: disable=pointless-string-statement
  '''
    # create the axis of thresholds (scores)
    thresholds = np.append(thresholds, 1.0)
    ax2 = plt.gca().twinx()
    ax2.plot(recall, thresholds, markeredgecolor='r', linestyle='dashed', color='r')
    ax2.set_ylabel('Threshold', color='r')
    ax2.set_ylim( [thresholds[0], thresholds[-1]] )
    ax2.set_xlim( [recall[0], recall[-1]] )
  '''

  plt.savefig(save_path)
  plt.close()
def plot_pr ( precision , recall , thresholds , save_path ) : # pylint: disable=unused-argument plt . figure ( ) plt . step ( recall , precision , color = 'b' , alpha = 0.2 , where = 'post' ) plt . fill_between ( recall , precision , step = 'post' , alpha = 0.2 , color = 'b' ) plt . ylim ( [ 0.0 , 1.05 ] ) plt . xlim ( [ 0.0 , 1.0 ] ) plt . xlabel ( 'Recall' ) plt . ylabel ( 'Precision' ) plt . title ( '2-class Precision-Recall curve' ) plt . legend ( loc = 'lower right' ) # pylint: disable=pointless-string-statement '''
    # create the axis of thresholds (scores)
    thresholds = np.append(thresholds, 1.0)
    ax2 = plt.gca().twinx()
    ax2.plot(recall, thresholds, markeredgecolor='r', linestyle='dashed', color='r')
    ax2.set_ylabel('Threshold', color='r')
    ax2.set_ylim( [thresholds[0], thresholds[-1]] )
    ax2.set_xlim( [recall[0], recall[-1]] )
  ''' plt . savefig ( save_path ) plt . close ( )