# tff.learning.robust_aggregator

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) 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) |

Creates aggregator for mean with adaptive zeroing and clipping.

    tff.learning.robust_aggregator(
        *,
        zeroing: bool = True,
        clipping: bool = True,
        weighted: bool = True,
        debug_measurements_fn: Optional[Callable[[https://www.tensorflow.org/federated/api_docs/python/tff/aggregators/AggregationFactory], https://www.tensorflow.org/federated/api_docs/python/tff/aggregators/AggregationFactory]] = None
    ) -> https://www.tensorflow.org/federated/api_docs/python/tff/aggregators/AggregationFactory

Zeroes out extremely large values for robustness to data corruption on
clients, and clips in the L2 norm to moderately high norm for robustness to
outliers.

Adaptive clipping approach is as described in Andrew, Thakkar et al. (2021)
<https://arxiv.org/abs/1905.03871,> which the robust_aggregator applies without
the addition of noise.

For details on clipping and zeroing see [`tff.aggregators.clipping_factory`](https://www.tensorflow.org/federated/api_docs/python/tff/aggregators/clipping_factory)
and [`tff.aggregators.zeroing_factory`](https://www.tensorflow.org/federated/api_docs/python/tff/aggregators/zeroing_factory). For details on the quantile-based
adaptive algorithm see [`tff.aggregators.PrivateQuantileEstimationProcess`](https://www.tensorflow.org/federated/api_docs/python/tff/aggregators/PrivateQuantileEstimationProcess).

<br />

<br />

<br />

| ## Args ||
|---|---|
| `zeroing` | Whether to enable adaptive zeroing for data corruption mitigation. |
| `clipping` | Whether to enable adaptive clipping in the L2 norm for robustness. |
| `weighted` | Whether the mean is weighted (vs. unweighted). |
| `debug_measurements_fn` | A callable to add measurements suitable for debugging learning algorithms. Often useful values include None, [`tff.learning.add_debug_measurements`](https://www.tensorflow.org/federated/api_docs/python/tff/learning/add_debug_measurements) or [`tff.learning.add_debug_measurements_with_mixed_dtype`](https://www.tensorflow.org/federated/api_docs/python/tff/learning/add_debug_measurements_with_mixed_dtype). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A [`tff.aggregators.AggregationFactory`](https://www.tensorflow.org/federated/api_docs/python/tff/aggregators/AggregationFactory). ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `TypeError` | if debug_measurement_fn yields an aggregation factory whose weight type does not match `weighted`. |

<br />