Builds the TFF computation for federated evaluation of the given model.
tff.learning.build_federated_evaluation(
model_fn: Union[Callable[[], tff.learning.models.VariableModel
], tff.learning.models.FunctionalModel
],
broadcast_process: Optional[tff.templates.MeasuredProcess
] = None,
metrics_aggregator: Optional[_MetricsAggregator] = None,
use_experimental_simulation_loop: bool = False
) -> tff.Computation
Used in the notebooks
Args |
model_fn
|
A no-arg function that returns a
tff.learning.models.VariableModel , or an instance of a
tff.learning.models.FunctionalModel . When passing a callable, the
callable must not capture TensorFlow tensors or variables and use them.
The model must be constructed entirely from scratch on each invocation,
returning the same pre-constructed model each call will result in an
error.
|
broadcast_process
|
A tff.templates.MeasuredProcess that broadcasts the
model weights on the server to the clients. It must support the signature
(input_values@SERVER -> output_values@CLIENTS) and have empty state. If
set to default None, the server model is broadcast to the clients using
the default tff.federated_broadcast.
|
metrics_aggregator
|
An optional function that takes in the metric finalizers
(i.e., tff.learning.models.VariableModel.metric_finalizers() ) and a
tff.types.StructWithPythonType of the unfinalized metrics (i.e., the TFF
type of
tff.learning.models.VariableModel.report_local_unfinalized_metrics() ),
and returns a federated TFF computation of the following type signature
local_unfinalized_metrics@CLIENTS -> aggregated_metrics@SERVER . If
None , uses tff.learning.metrics.sum_then_finalize , which returns a
federated TFF computation that sums the unfinalized metrics from
CLIENTS , and then applies the corresponding metric finalizers at
SERVER .
|
use_experimental_simulation_loop
|
Controls the reduce loop function for
input dataset. An experimental reduce loop is used for simulation.
|
Returns |
A federated computation (an instance of tff.Computation ) that accepts
model parameters and federated data, and returns the evaluation metrics.
|