ray.data.aggregate.Max.finalize#
- Max.finalize(accumulator: AggType) U | None #
Transforms the final accumulated state into the desired output.
This method is called once per group after all blocks have been processed and all partial results have been combined. It provides an opportunity to perform a final transformation on the accumulated data.
For many aggregations (e.g., Sum, Count, Min, Max), the accumulated state is already the final result, so this method can simply return the accumulator as is (which is the default behavior).
For other aggregations, like Mean, this method is crucial. A Mean aggregation might accumulate
[sum, count]
. The_finalize
method would then computesum / count
to get the final mean.- Parameters:
accumulator – The final accumulated state for a group, after all
aggregate_block
andcombine
operations.- Returns:
The final result of the aggregation for the group.