tff.federated_aggregate
Stay organized with collections
Save and categorize content based on your preferences.
Aggregates value
from tff.CLIENTS
to tff.SERVER
.
tff.federated_aggregate(
value, zero, accumulate, merge, report
) -> tff.Value
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 value
contributed by clients in the group are first
reduced using reduction operator accumulate
with zero
as the zero in the
algebra. If members of value
are of type T
, and zero
(the result of
reducing an empty set) is of type U
, the reduction operator accumulate
used 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.
Next, the U
-typed items generated by the preceding stage are merged using
the binary commutative associative operator merge
of type (<U,U> -> U)
.
The result of this stage is a single top-level U
that emerges at the root
of the hierarchy at the tff.SERVER
. Actual implementations may structure
this step as a cascade of multiple layers.
Finally, the U
-typed result of the reduction performed in the preceding
stage is projected into the result value using report
as the mapping
function (for example, if the structures being merged consist of counters,
this final step might include computing their ratios).
Args |
value
|
A value of a TFF federated type placed at tff.CLIENTS to aggregate.
|
zero
|
The zero of type U in the algebra of reduction operators, as
described above.
|
accumulate
|
The reduction operator to use in the first stage of the process.
If value is of type {T}@CLIENTS , and zero is of type U , this
operator should be of type (<U,T> -> U) .
|
merge
|
The reduction operator to employ in the second stage of the process.
Must be of type (<U,U> -> U) , where U is as defined above.
|
report
|
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
returned by tff.federated_aggregate is of type R@SERVER , this operator
must be of type (U -> R) .
|
Returns |
A representation on the tff.SERVER of the result of aggregating value
using the multi-stage process described above.
|
Raises |
TypeError
|
If the arguments are not of the types specified above.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-20 UTC.
[null,null,["Last updated 2024-09-20 UTC."],[],[],null,["# tff.federated_aggregate\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/federated/blob/v0.87.0 Version 2.0, January 2004 Licensed under the Apache License, Version 2.0 (the) |\n\nAggregates `value` from [`tff.CLIENTS`](../tff#CLIENTS) to [`tff.SERVER`](../tff#SERVER). \n\n tff.federated_aggregate(\n value, zero, accumulate, merge, report\n ) -\u003e ../tff/Value\n\nThis generalized aggregation function admits multi-layered architectures that\ninvolve one or more intermediate stages to handle scalable aggregation across\na very large number of participants.\n\nThe multi-stage aggregation process is defined as follows:\n\n- Clients are organized into groups. Within each group, a set of all the\n member constituents of `value` contributed by clients in the group are first\n reduced using reduction operator `accumulate` with `zero` as the zero in the\n algebra. If members of `value` are of type `T`, and `zero` (the result of\n reducing an empty set) is of type `U`, the reduction operator `accumulate`\n used at this stage should be of type `(\u003cU,T\u003e -\u003e U)`. The result of this\n stage is a set of items of type `U`, one item for each group of clients.\n\n- Next, the `U`-typed items generated by the preceding stage are merged using\n the binary commutative associative operator `merge` of type `(\u003cU,U\u003e -\u003e U)`.\n The result of this stage is a single top-level `U` that emerges at the root\n of the hierarchy at the [`tff.SERVER`](../tff#SERVER). Actual implementations may structure\n this step as a cascade of multiple layers.\n\n- Finally, the `U`-typed result of the reduction performed in the preceding\n stage is projected into the result value using `report` as the mapping\n function (for example, if the structures being merged consist of counters,\n this final step might include computing their ratios).\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `value` | A value of a TFF federated type placed at [`tff.CLIENTS`](../tff#CLIENTS) to aggregate. |\n| `zero` | The zero of type `U` in the algebra of reduction operators, as described above. |\n| `accumulate` | The reduction operator to use in the first stage of the process. If `value` is of type `{T}@CLIENTS`, and `zero` is of type `U`, this operator should be of type `(\u003cU,T\u003e -\u003e U)`. |\n| `merge` | The reduction operator to employ in the second stage of the process. Must be of type `(\u003cU,U\u003e -\u003e U)`, where `U` is as defined above. |\n| `report` | 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 returned by [`tff.federated_aggregate`](../tff/federated_aggregate) is of type `R@SERVER`, this operator must be of type `(U -\u003e R)`. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A representation on the [`tff.SERVER`](../tff#SERVER) of the result of aggregating `value` using the multi-stage process described above. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|-------------|--------------------------------------------------------|\n| `TypeError` | If the arguments are not of the types specified above. |\n\n\u003cbr /\u003e"]]