parallel_mean#

parallel_mean(mean_a, count_a, mean_b, count_b)[source]#

Compute the mean based on stats from two partitions of the data.

See “Parallel Algorithm” in https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance

Parameters:
  • mean_a – the mean of partition a

  • count_a – the number of elements in partition a

  • mean_b – the mean of partition b

  • count_b – the number of elements in partition b

Returns:

the mean of the two partitions if they were combined