code: Minor corrections for HUE
This commit is contained in:
		@ -46,15 +46,15 @@ def main(args):
 | 
			
		||||
  # The y axis
 | 
			
		||||
  plt.ylabel('Mean absolute error')  # Set y axis label.
 | 
			
		||||
  # plt.yscale('log')
 | 
			
		||||
  plt.ylim(0, 8)
 | 
			
		||||
  # plt.ylim(0, 8)
 | 
			
		||||
  # Bar offset
 | 
			
		||||
  x_offset = -(bar_width/2)*(n - 1)
 | 
			
		||||
 | 
			
		||||
  mae_u = np.zeros(len(lmdks_pct))
 | 
			
		||||
  mae_s = np.zeros(len(lmdks_pct))
 | 
			
		||||
  mae_a = np.zeros(len(lmdks_pct))
 | 
			
		||||
  mae_evt = np.zeros(len(lmdks_pct))
 | 
			
		||||
  mae_usr = np.zeros(len(lmdks_pct))
 | 
			
		||||
  mae_evt = 0
 | 
			
		||||
  mae_usr = 0
 | 
			
		||||
 | 
			
		||||
  for i, pct in enumerate(lmdks_pct):
 | 
			
		||||
    # Find landmarks
 | 
			
		||||
@ -71,7 +71,7 @@ def main(args):
 | 
			
		||||
      # lmdk_bgt.validate_bgts(seq, lmdks, epsilon, bgts_u)
 | 
			
		||||
      mae_u[i] += lmdk_bgt.mae_cons(seq, rls_data_u)/args.iter
 | 
			
		||||
 | 
			
		||||
      # # Adaptive
 | 
			
		||||
      # Adaptive
 | 
			
		||||
      rls_data_a, _, _ = lmdk_bgt.adaptive_cons(seq, lmdks, epsilon, .5, .5)
 | 
			
		||||
      mae_a[i] += lmdk_bgt.mae_cons(seq, rls_data_a)/args.iter
 | 
			
		||||
 | 
			
		||||
@ -79,26 +79,24 @@ def main(args):
 | 
			
		||||
      # Calculate once
 | 
			
		||||
      if i == 0:
 | 
			
		||||
        rls_data_evt, _ = lmdk_bgt.uniform_cons(seq, seq[seq[:, 1] < lmdks_th[0]], epsilon)
 | 
			
		||||
      mae_evt[i] += lmdk_bgt.mae_cons(seq, rls_data_evt)/args.iter
 | 
			
		||||
        mae_evt += lmdk_bgt.mae_cons(seq, rls_data_evt)/args.iter
 | 
			
		||||
      # User
 | 
			
		||||
      # Calculate once
 | 
			
		||||
      if i == 0:
 | 
			
		||||
        rls_data_usr, _ = lmdk_bgt.uniform_cons(seq, seq[seq[:, 1] < lmdks_th[len(lmdks_th)-1]], epsilon)
 | 
			
		||||
      mae_usr[i] += lmdk_bgt.mae_cons(seq, rls_data_usr)/args.iter
 | 
			
		||||
        mae_usr += lmdk_bgt.mae_cons(seq, rls_data_usr)/args.iter
 | 
			
		||||
 | 
			
		||||
  plt.plot(
 | 
			
		||||
    x_i,
 | 
			
		||||
    mae_evt,
 | 
			
		||||
  plt.axhline(
 | 
			
		||||
    y = mae_evt,
 | 
			
		||||
    linewidth=lmdk_lib.line_width
 | 
			
		||||
  )
 | 
			
		||||
  plt.text(x_i[-1], mae_evt[-1], '        event')
 | 
			
		||||
  plt.text(x_i[-1], mae_evt, '        event')
 | 
			
		||||
 | 
			
		||||
  plt.plot(
 | 
			
		||||
    x_i,
 | 
			
		||||
    mae_usr,
 | 
			
		||||
  plt.axhline(
 | 
			
		||||
    y = mae_usr,
 | 
			
		||||
    linewidth=lmdk_lib.line_width
 | 
			
		||||
  )
 | 
			
		||||
  plt.text(x_i[-1], mae_usr[-1], '        user')
 | 
			
		||||
  plt.text(x_i[-1], mae_usr, '        user')
 | 
			
		||||
 | 
			
		||||
  plt.bar(
 | 
			
		||||
    x_i + x_offset,
 | 
			
		||||
 | 
			
		||||
@ -443,7 +443,7 @@ def adaptive_cons(seq, lmdks, epsilon, inc_rt, dec_rt):
 | 
			
		||||
    else:
 | 
			
		||||
      skipped += 1
 | 
			
		||||
      # Skip current release and approximate with previous
 | 
			
		||||
      rls_data[i] = rls_data[i - 1]
 | 
			
		||||
      rls_data[i] = [p[0], rls_data[i - 1][1]]
 | 
			
		||||
      if is_landmark:
 | 
			
		||||
        # Allocate the current budget to the following releases uniformly
 | 
			
		||||
        for j in range(i + 1, len(seq)):
 | 
			
		||||
@ -538,7 +538,7 @@ def skip_cons(seq, lmdks, epsilon):
 | 
			
		||||
    if is_landmark:
 | 
			
		||||
      if i > 0:
 | 
			
		||||
        # Approximate with previous
 | 
			
		||||
        o = rls_data[i - 1]
 | 
			
		||||
        o[1] = rls_data[i - 1][1]
 | 
			
		||||
      bgts[i] = 0
 | 
			
		||||
    rls_data[i] = o
 | 
			
		||||
  return rls_data, bgts
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user