Module: tff.learning.metrics

Libraries for working with metrics in federated learning algorithms.

Classes

class FinalizeThenSampleFactory: Aggregation Factory that finalizes and then samples the metrics.

class MetricsAggregatorType: Base class for protocol classes.

class NumBatchesCounter: A tf.keras.metrics.Metric that counts the number of batches seen.

class NumExamplesCounter: A tf.keras.metrics.Metric that counts the number of examples seen.

class SecureSumFactory: Aggregation Factory that performs secure summation over metrics.

class SumThenFinalizeFactory: Aggregation Factory that sums and then finalizes the metrics.

Functions

create_default_secure_sum_quantization_ranges(...): Create a nested structure of quantization ranges for secure sum encoding.

create_functional_metric_fns(...): Turn a Keras metric construction method into a tuple of pure functions.

create_keras_metric_finalizer(...): Creates a finalizer function for the given Keras metric.

finalize_then_sample(...): Creates a TFF computation to aggregate metrics via finalize_then_sample.

secure_sum_then_finalize(...): Creates a TFF computation that aggregates metrics using secure summation.

sum_then_finalize(...): Creates a TFF computation that aggregates metrics via sum_then_finalize.

Type Aliases

FunctionalMetricFinalizersType

MetricFinalizersType