|View source on GitHub|
tff.federated_aggregate( value, zero, accumulate, merge, report )
This generalized aggregation function admits multi-layered architectures that involve one or more intermediate stages to handle scalable aggregation across a very large number of participants.
The multi-stage aggregation process is defined as follows:
Clients are organized into groups. Within each group, a set of all the member constituents of
valuecontributed by clients in the group are first reduced in a manner similar to
tff.federated_reduceusing reduction operator
zeroas the zero in the algebra. As described in the documentation for
tff.federated_reduce, if members of
valueare of type
zero(the result of reducing an empty set) is of type
U, the reduction operator
accumulateused at this stage should be of type
(<U,T> -> U). The result of this stage is a set of items of type
U, one item for each group of clients.
U-typed items generated by the preceding stage are merged using the binary commutative associative operator
(<U,U> -> U). This can be interpreted as a
mergeas the reduction operator, and the same
zeroin the algebra. The result of this stage is a single top-level
Uthat emerges at the root of the hierarchy at the
tff.SERVER. Actual implementations may structure this step as a cascade of multiple layers.
U-typed result of the reduction performed in the preceding stage is projected into the result value using
reportas the mapping function (for example, if the structures being merged consist of counters, this final step might include computing their ratios).
A value of a TFF federated type placed at
The zero of type
The reduction operator to use in the first stage of the process.
The reduction operator to employ in the second stage of the process.
Must be of type
The projection operator to use at the final stage of the process to
compute the final result of aggregation. If the intended result to be
A representation on the
||If the arguments are not of the types specified above.|