Attend the Women in ML Symposium on December 7 Register now


Stay organized with collections Save and categorize content based on your preferences.

Creates a TFF computation that aggregates metrics via sum_then_finalize.

The returned federated TFF computation has the following type signature: local_unfinalized_metrics@CLIENTS -> aggregated_metrics@SERVER, where the input is given by tff.learning.Model.report_local_unfinalized_metrics() at CLIENTS, and the output is computed by first summing the unfinalized metrics from CLIENTS, followed by applying the finalizers at SERVER.

metric_finalizers Either the result of tff.learning.Model.metric_finalizers (an OrderedDict of callables) or the tff.learning.models.FunctionalModel.finalize_metrics method (a callable that takes an OrderedDict argument). If the former, the keys must be the same as the OrderedDict returned by tff.learning.Model.report_local_unfinalized_metrics. If the later, the callable must compute over the same keyspace of the result returned by tff.learning.models.FunctionalModel.update_metrics_state.
local_unfinalized_metrics_type A tff.types.StructWithPythonType (with OrderedDict as the Python container) of a client's local unfinalized metrics. Let local_unfinalized_metrics be the output of tff.learning.Model.report_local_unfinalized_metrics(). Its type can be obtained by tff.framework.type_from_tensors(local_unfinalized_metrics).

A federated TFF computation that sums the unfinalized metrics from CLIENTS, and applies the correponding finalizers at SERVER.

TypeError If the inputs are of the wrong types.
ValueError If the keys (i.e., metric names) in metric_finalizers are not the same as those expected by local_unfinalized_metrics_type.