def mean
      mean_len = 0
      weight = 0

      lengths.each do |length, n|
        mean_len += length * n
        weight += n
      end
      mean_len /= weight
    end
def mean
      mean_len = 0
      weight = 0

      lengths.each do |length, n|
        mean_len += length * n
        weight += n
      end
      mean_len /= weight
    end
Returns the weighted mean value of the cluster