我要绘制far和frr的曲线,但是在Im编码时出现错误

时间:2018-12-18 05:43:55

标签: python

我的错误如下:

raise ValueError("x and y must have same first dimension")
ValueError: x and y must have same first dimension

我认为X和Y的尺寸均为100

此函数绘制far和frr的曲线:

def plot_far_frr(far, frr):

  axisVal = np.arange(0,1.00,0.01)

  # PLOT FAR FRR
  plt.figure()
  lw = 2
  plt.plot(axisVal,far.values(), label='False Accept Rate', color='blue', lw=lw)
  plt.plot(axisVal,frr.values(), label='False Reject Rate', color='red', lw=lw)
  # plt.plot(axisVal, far, label='False Accept Rate', color='blue', lw=lw)
  # plt.plot(axisVal, frr, label='False Reject Rate', color='red', lw=lw)
  plt.xlim([0.0, 1.0])
  plt.ylim([0.0, 1.05])
  plt.xlabel('Treshold')
  plt.ylabel('Errors')
  plt.title('FAR and FRR')
  plt.legend(loc="upper left")

这部分是far和frr的计算:

def prepare_graph_far_frr(actual, score, totalP, totalN):
  step = 1
  far = dict()
  frr = dict()

  for i in range(0, 100, step):
    _, FP, _, FN = perf_measure(actual, score, i/float(100))
    far[i], frr[i] = calc_far_frr(FP, FN, totalP, totalN)
  return far, frr

感谢您的帮助。

0 个答案:

没有答案