tff.aggregators.PrivateQuantileEstimationProcess
Stay organized with collections
Save and categorize content based on your preferences.
A tff.templates.EstimationProcess
for estimating private quantiles.
Inherits From: EstimationProcess
, IterativeProcess
tff.aggregators.PrivateQuantileEstimationProcess(
quantile_estimator_query: tfp.QuantileEstimatorQuery,
record_aggregation_factory: Optional[tff.aggregators.UnweightedAggregationFactory
] = None
)
Used in the notebooks
This iterative process uses a tensorflow_privacy.QuantileEstimatorQuery
to
maintain an estimate of the target quantile that is updated after each round.
The next
function has the following type signature:
(<{state_type}@SERVER,{float32}@CLIENTS> -> {state_type}@SERVER)
Given a state
of type state_type
, the most recent estimate of the target
quantile can be retrieved using report(state)
.
Attributes |
initialize
|
A no-arg tff.Computation that returns the initial state.
|
next
|
A tff.Computation that produces the next state.
Its first argument should always be the current state (originally produced
by tff.templates.IterativeProcess.initialize ), and the first (or only)
returned value is the updated state.
|
report
|
A tff.Computation that computes the current estimate from state .
Given a state controlled by this process, computes and returns the most
recent estimate of the estimated value.
|
state_type
|
The tff.Type of the state of the process.
|
Methods
map
View source
map(
map_fn: tff.Computation
)
Applies map_fn
to the estimate function of the process.
This method will return a new instance of EstimationProcess
with the same
initailize
and next
functions, and its report
function replaced by
map_fn(report(state))
.
Args |
map_fn
|
A tff.Computation to apply to the result of the report
function of the process. Must accept the return type of report .
|
Returns |
An EstimationProcess .
|
Raises |
EstimateNotAssignableError
|
If the return type of report is not
assignable to the expected input type of map_fn .
|
no_noise
View source
@classmethod
no_noise(
initial_estimate: float,
target_quantile: float,
learning_rate: float,
multiplier: float = 1.0,
increment: float = 0.0,
secure_estimation: bool = False
)
No-noise estimator for affine function of value at quantile.
Estimates value C
at q
'th quantile of input distribution and reports
rC + i
for multiplier r
and increment i
. The quantile C
is estimated
using the geometric method described in Andrew, Thakkar et al. 2021,
"Differentially Private Learning with Adaptive Clipping"
(https://arxiv.org/abs/1905.03871) without noise added.
Note that this estimator does not add noise, so it does not guarantee
differential privacy. It is useful for estimating quantiles in contexts
where rigorous privacy guarantees are not needed.
Args |
initial_estimate
|
The initial estimate of C .
|
target_quantile
|
The quantile q to which C will be adapted.
|
learning_rate
|
The learning rate for the adaptive algorithm.
|
multiplier
|
The multiplier r of the affine transform.
|
increment
|
The increment i of the affine transform.
|
secure_estimation
|
Whether to perform the aggregation for estimation using
tff.aggregators.SumFactory (if False ; default) or
tff.aggregators.SecureSumFactory (if True ).
|
Returns |
An EstimationProcess whose report function returns rC + i .
|
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-20 UTC."],[],[],null,["# tff.aggregators.PrivateQuantileEstimationProcess\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\nA [`tff.templates.EstimationProcess`](../../tff/templates/EstimationProcess) for estimating private quantiles.\n\nInherits From: [`EstimationProcess`](../../tff/templates/EstimationProcess), [`IterativeProcess`](../../tff/templates/IterativeProcess) \n\n tff.aggregators.PrivateQuantileEstimationProcess(\n quantile_estimator_query: tfp.QuantileEstimatorQuery,\n record_aggregation_factory: Optional[../../tff/aggregators/UnweightedAggregationFactory] = None\n )\n\n### Used in the notebooks\n\n| Used in the tutorials |\n|---------------------------------------------------------------------------------------------------------------------------------|\n| - [Tuning recommended aggregations for learning](https://www.tensorflow.org/federated/tutorials/tuning_recommended_aggregators) |\n\nThis iterative process uses a `tensorflow_privacy.QuantileEstimatorQuery` to\nmaintain an estimate of the target quantile that is updated after each round.\nThe `next` function has the following type signature:\n\n(\\\u003c{state_type}@SERVER,{float32}@CLIENTS\\\u003e -\\\u003e {state_type}@SERVER)\n\nGiven a `state` of type `state_type`, the most recent estimate of the target\nquantile can be retrieved using `report(state)`.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `quantile_estimator_query` | A `tfp.QuantileEstimatorQuery` for estimating quantiles with differential privacy. |\n| `record_aggregation_factory` | An optional [`tff.aggregators.UnweightedAggregationFactory`](../../tff/aggregators/UnweightedAggregationFactory) to aggregate counts of values below the current estimate. If `None`, defaults to [`tff.aggregators.SumFactory`](../../tff/aggregators/SumFactory). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ---------- ||\n|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `initialize` | A no-arg [`tff.Computation`](../../tff/Computation) that returns the initial state. |\n| `next` | A [`tff.Computation`](../../tff/Computation) that produces the next state. \u003cbr /\u003e Its first argument should always be the current state (originally produced by [`tff.templates.IterativeProcess.initialize`](../../tff/templates/IterativeProcess#initialize)), and the first (or only) returned value is the updated state. |\n| `report` | A [`tff.Computation`](../../tff/Computation) that computes the current estimate from `state`. \u003cbr /\u003e Given a `state` controlled by this process, computes and returns the most recent estimate of the estimated value. |\n| `state_type` | The [`tff.Type`](../../tff/types/Type) of the state of the process. |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `map`\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 map(\n map_fn: ../../tff/Computation\n )\n\nApplies `map_fn` to the estimate function of the process.\n\nThis method will return a new instance of `EstimationProcess` with the same\n`initailize` and `next` functions, and its `report` function replaced by\n`map_fn(report(state))`.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `map_fn` | A [`tff.Computation`](../../tff/Computation) to apply to the result of the `report` function of the process. Must accept the return type of `report`. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| An `EstimationProcess`. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ||\n|------------------------------|------------------------------------------------------------------------------------------|\n| `EstimateNotAssignableError` | If the return type of `report` is not assignable to the expected input type of `map_fn`. |\n\n\u003cbr /\u003e\n\n### `no_noise`\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 @classmethod\n no_noise(\n initial_estimate: float,\n target_quantile: float,\n learning_rate: float,\n multiplier: float = 1.0,\n increment: float = 0.0,\n secure_estimation: bool = False\n )\n\nNo-noise estimator for affine function of value at quantile.\n\nEstimates value `C` at `q`'th quantile of input distribution and reports\n`rC + i` for multiplier `r` and increment `i`. The quantile `C` is estimated\nusing the geometric method described in Andrew, Thakkar et al. 2021,\n\"Differentially Private Learning with Adaptive Clipping\"\n(\u003chttps://arxiv.org/abs/1905.03871\u003e) without noise added.\n\nNote that this estimator does not add noise, so it does not guarantee\ndifferential privacy. It is useful for estimating quantiles in contexts\nwhere rigorous privacy guarantees are not needed.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `initial_estimate` | The initial estimate of `C`. |\n| `target_quantile` | The quantile `q` to which `C` will be adapted. |\n| `learning_rate` | The learning rate for the adaptive algorithm. |\n| `multiplier` | The multiplier `r` of the affine transform. |\n| `increment` | The increment `i` of the affine transform. |\n| `secure_estimation` | Whether to perform the aggregation for estimation using [`tff.aggregators.SumFactory`](../../tff/aggregators/SumFactory) (if `False`; default) or [`tff.aggregators.SecureSumFactory`](../../tff/aggregators/SecureSumFactory) (if `True`). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| An `EstimationProcess` whose `report` function returns `rC + i`. ||\n\n\u003cbr /\u003e"]]