I need to compute the average of a vector of 3d points (stored as float4) grouped by another vector of keys. The easiest approach I can think of is to store a count in the 4th value of the float4 (which I am not using otherwise), initialize the count to 1, and then sum using reduce_by_keys. This seems kind of dirty, so I was wondering if there was a better way. Is there something like numpy's bincount that I haven't found?
I need to compute the average of a vector of 3d points (stored as float4) grouped by another vector of keys. The easiest approach I can think of is to store a count in the 4th value of the float4 (which I am not using otherwise), initialize the count to 1, and then sum using reduce_by_keys. This seems kind of dirty, so I was wondering if there was a better way. Is there something like numpy's bincount that I haven't found?
Thanks!