tff.aggregators.UnweightedMeanFactory
Stay organized with collections
Save and categorize content based on your preferences.
Aggregation factory for unweighted mean.
Inherits From: UnweightedAggregationFactory
tff.aggregators.UnweightedMeanFactory(
value_sum_factory: Optional[tff.aggregators.UnweightedAggregationFactory
] = None,
count_sum_factory: Optional[tff.aggregators.UnweightedAggregationFactory
] = None
)
The created 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.
Methods
create
View source
create(
value_type: factory.ValueType
) -> tff.templates.AggregationProcess
Creates a tff.aggregators.AggregationProcess
without weights.
The provided value_type
is a non-federated tff.Type
, that is, not a
tff.FederatedType
.
The returned tff.aggregators.AggregationProcess
will be created for
aggregation of values matching value_type
placed at 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.
Args |
value_type
|
A non-federated tff.Type .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-20 UTC.
[null,null,["Last updated 2024-09-20 UTC."],[],[],null,["# tff.aggregators.UnweightedMeanFactory\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [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) |\n\nAggregation factory for unweighted mean.\n\nInherits From: [`UnweightedAggregationFactory`](../../tff/aggregators/UnweightedAggregationFactory) \n\n tff.aggregators.UnweightedMeanFactory(\n value_sum_factory: Optional[../../tff/aggregators/UnweightedAggregationFactory] = None,\n count_sum_factory: Optional[../../tff/aggregators/UnweightedAggregationFactory] = None\n )\n\nThe created [`tff.templates.AggregationProcess`](../../tff/templates/AggregationProcess) computes the unweighted mean of\nvalues placed at `CLIENTS`, and outputs the mean placed at `SERVER`.\n\nThe input arguments of the `next` attribute of the process returned by\n`create` are `\u003cstate, value\u003e`, and the unweighted mean refers to the\nexpression `sum(value * weight) / count(value)` where `count(value)` is the\ncardinality of the `CLIENTS` placement.\n\nThe implementation is parameterized by an inner aggregation factory\nresponsible for the summation of values.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `value_sum_factory` | An optional [`tff.aggregators.UnweightedAggregationFactory`](../../tff/aggregators/UnweightedAggregationFactory) responsible for summation of values. If not specified, [`tff.aggregators.SumFactory`](../../tff/aggregators/SumFactory) is used. |\n| `count_sum_factory` | An optional [`tff.aggregators.UnweightedAggregationFactory`](../../tff/aggregators/UnweightedAggregationFactory) responsible for summation of ones to determine the cardinality of the `CLIENTS` placement. If not specified, [`tff.aggregators.SumFactory`](../../tff/aggregators/SumFactory) is used. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `TypeError` | If provided `value_sum_factory` or `count_sum_factory` is not an instance of [`tff.aggregators.UnweightedAggregationFactory`](../../tff/aggregators/UnweightedAggregationFactory). |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `create`\n\n[View source](https://github.com/tensorflow/federated/blob/v0.87.0\nVersion 2.0, January 2004\nLicensed under the Apache License, Version 2.0 (the) \n\n create(\n value_type: factory.ValueType\n ) -\u003e ../../tff/templates/AggregationProcess\n\nCreates a `tff.aggregators.AggregationProcess` without weights.\n\nThe provided `value_type` is a non-federated [`tff.Type`](../../tff/types/Type), that is, not a\n[`tff.FederatedType`](../../tff/types/FederatedType).\n\nThe returned `tff.aggregators.AggregationProcess` will be created for\naggregation of values matching `value_type` placed at [`tff.CLIENTS`](../../tff#CLIENTS).\nThat is, its `next` method will expect type\n`\u003cS@SERVER, {value_type}@CLIENTS\u003e`, where `S` is the unplaced return type of\nits `initialize` method.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|--------------|-----------------------------------------------------|\n| `value_type` | A non-federated [`tff.Type`](../../tff/types/Type). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| A [`tff.templates.AggregationProcess`](../../tff/templates/AggregationProcess). ||\n\n\u003cbr /\u003e"]]