avg_dist: Minor correction
This commit is contained in:
		@ -45,7 +45,7 @@ def main(args):
 | 
				
			|||||||
    # Logging
 | 
					    # Logging
 | 
				
			||||||
    print('.', end='', flush=True)
 | 
					    print('.', end='', flush=True)
 | 
				
			||||||
    for i, n in enumerate(lmdk_n):
 | 
					    for i, n in enumerate(lmdk_n):
 | 
				
			||||||
      for r in range(args.reps):
 | 
					      for r in range(args.iter):
 | 
				
			||||||
        # Generate landmarks
 | 
					        # Generate landmarks
 | 
				
			||||||
        lmdks = lmdk_lib.get_lmdks(seq, n, d)
 | 
					        lmdks = lmdk_lib.get_lmdks(seq, n, d)
 | 
				
			||||||
        # Calculate average distance
 | 
					        # Calculate average distance
 | 
				
			||||||
@ -54,7 +54,7 @@ def main(args):
 | 
				
			|||||||
          t_prv, t_nxt = gdp.get_limits(t, seq, lmdks)
 | 
					          t_prv, t_nxt = gdp.get_limits(t, seq, lmdks)
 | 
				
			||||||
          avg_cur += (abs(t - t_prv) - 1 + abs(t - t_nxt) - 1 )/len(seq)
 | 
					          avg_cur += (abs(t - t_prv) - 1 + abs(t - t_nxt) - 1 )/len(seq)
 | 
				
			||||||
        # Normalized average based on repetitions
 | 
					        # Normalized average based on repetitions
 | 
				
			||||||
        avg_dist[i] += avg_cur/args.reps
 | 
					        avg_dist[i] += avg_cur/args.iter
 | 
				
			||||||
    # Rescaling (min-max normalization)
 | 
					    # Rescaling (min-max normalization)
 | 
				
			||||||
    # https://en.wikipedia.org/wiki/Feature_scaling#Rescaling_(min-max_normalization)
 | 
					    # https://en.wikipedia.org/wiki/Feature_scaling#Rescaling_(min-max_normalization)
 | 
				
			||||||
    avg_dist = (avg_dist - avg_dist.min())/(avg_dist.max() - avg_dist.min())
 | 
					    avg_dist = (avg_dist - avg_dist.min())/(avg_dist.max() - avg_dist.min())
 | 
				
			||||||
@ -88,7 +88,7 @@ def main(args):
 | 
				
			|||||||
  Parse arguments.
 | 
					  Parse arguments.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Optional:
 | 
					  Optional:
 | 
				
			||||||
    reps - The number of repetitions.
 | 
					    iter - The total iterations.
 | 
				
			||||||
    time - The time limit of the sequence.
 | 
					    time - The time limit of the sequence.
 | 
				
			||||||
'''
 | 
					'''
 | 
				
			||||||
def parse_args():
 | 
					def parse_args():
 | 
				
			||||||
@ -98,7 +98,7 @@ def parse_args():
 | 
				
			|||||||
  # Mandatory arguments.
 | 
					  # Mandatory arguments.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Optional arguments.
 | 
					  # Optional arguments.
 | 
				
			||||||
  parser.add_argument('-r', '--reps', help='The number of repetitions.', type=int, default=1)
 | 
					  parser.add_argument('-i', '--iter', help='The total iterations.', type=int, default=1)
 | 
				
			||||||
  parser.add_argument('-t', '--time', help='The time limit of the sequence.', type=int, default=100)
 | 
					  parser.add_argument('-t', '--time', help='The time limit of the sequence.', type=int, default=100)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Parse arguments.
 | 
					  # Parse arguments.
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user