def calculate_centroid(self):
    """
    average of all the PrimitiveParameters in self.simplex_points
    ComplexParameters are copied from self.simplex_points[0]
    """
    sums = defaultdict(float)
    counts = defaultdict(int)

    for config in self.simplex_points:
      cfg = config.data
      for param in self.manipulator.parameters(cfg):
        if param.is_primitive():
          sums[param.name] += param.get_unit_value(cfg)
          counts[param.name] += 1

    centroid = self.manipulator.copy(self.simplex_points[0].data)
    for param in self.manipulator.parameters(centroid):
      if param.is_primitive():
        param.set_unit_value(centroid,
                             sums[param.name] / float(counts[param.name]))

    return centroid
dataset/ETHPy150Open jansel/opentuner/opentuner/search/simplextechniques.py/SimplexTechnique.calculate_centroid/original