# tff.aggregators.UnweightedMeanFactory

<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) |

Aggregation factory for unweighted mean.

Inherits From: [`UnweightedAggregationFactory`](https://www.tensorflow.org/federated/api_docs/python/tff/aggregators/UnweightedAggregationFactory)

    tff.aggregators.UnweightedMeanFactory(
        value_sum_factory: Optional[https://www.tensorflow.org/federated/api_docs/python/tff/aggregators/UnweightedAggregationFactory] = None,
        count_sum_factory: Optional[https://www.tensorflow.org/federated/api_docs/python/tff/aggregators/UnweightedAggregationFactory] = None
    )

The created [`tff.templates.AggregationProcess`](https://www.tensorflow.org/federated/api_docs/python/tff/templates/AggregationProcess) computes the unweighted mean of
values placed at `CLIENTS`, and outputs the mean placed at `SERVER`.

The input arguments of the `next` attribute of the process returned by
`create` are `<state, value>`, and the unweighted mean refers to the
expression `sum(value * weight) / count(value)` where `count(value)` is the
cardinality of the `CLIENTS` placement.

The implementation is parameterized by an inner aggregation factory
responsible for the summation of values.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `value_sum_factory` | An optional [`tff.aggregators.UnweightedAggregationFactory`](https://www.tensorflow.org/federated/api_docs/python/tff/aggregators/UnweightedAggregationFactory) responsible for summation of values. If not specified, [`tff.aggregators.SumFactory`](https://www.tensorflow.org/federated/api_docs/python/tff/aggregators/SumFactory) is used. |
| `count_sum_factory` | An optional [`tff.aggregators.UnweightedAggregationFactory`](https://www.tensorflow.org/federated/api_docs/python/tff/aggregators/UnweightedAggregationFactory) responsible for summation of ones to determine the cardinality of the `CLIENTS` placement. If not specified, [`tff.aggregators.SumFactory`](https://www.tensorflow.org/federated/api_docs/python/tff/aggregators/SumFactory) is used. |

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `TypeError` | If provided `value_sum_factory` or `count_sum_factory` is not an instance of [`tff.aggregators.UnweightedAggregationFactory`](https://www.tensorflow.org/federated/api_docs/python/tff/aggregators/UnweightedAggregationFactory). |

<br />

## Methods

### `create`

[View source](https://github.com/tensorflow/federated/blob/v0.87.0
Version 2.0, January 2004
Licensed under the Apache License, Version 2.0 (the)

    create(
        value_type: factory.ValueType
    ) -> https://www.tensorflow.org/federated/api_docs/python/tff/templates/AggregationProcess

Creates a `tff.aggregators.AggregationProcess` without weights.

The provided `value_type` is a non-federated [`tff.Type`](https://www.tensorflow.org/federated/api_docs/python/tff/types/Type), that is, not a
[`tff.FederatedType`](https://www.tensorflow.org/federated/api_docs/python/tff/types/FederatedType).

The returned `tff.aggregators.AggregationProcess` will be created for
aggregation of values matching `value_type` placed at [`tff.CLIENTS`](https://www.tensorflow.org/federated/api_docs/python/tff#CLIENTS).
That is, its `next` method will expect type
`<S@SERVER, {value_type}@CLIENTS>`, where `S` is the unplaced return type of
its `initialize` method.

<br />

<br />

<br />

| Args ||
|---|---|
| `value_type` | A non-federated [`tff.Type`](https://www.tensorflow.org/federated/api_docs/python/tff/types/Type). |

<br />

<br />

<br />

<br />

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

<br />