View source on GitHub |
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.
Args | |
---|---|
value_sum_factory
|
An optional
tff.aggregators.UnweightedAggregationFactory responsible for summation
of values. If not specified, tff.aggregators.SumFactory is used.
|
count_sum_factory
|
An optional
tff.aggregators.UnweightedAggregationFactory responsible for summation
of ones to determine the cardinality of the CLIENTS placement. If not
specified, tff.aggregators.SumFactory is used.
|
Raises | |
---|---|
TypeError
|
If provided value_sum_factory or count_sum_factory is not
an instance of tff.aggregators.UnweightedAggregationFactory .
|
Methods
create
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 .
|
Returns | |
---|---|
A tff.templates.AggregationProcess .
|