interactive_measurements#

Measurements that allow interactively submitting queries to a private dataset.

Functions#

create_adaptive_composition()

Returns a measurement to launch a DecoratedQueryable.

create_adaptive_composition(input_domain, input_metric, d_in, privacy_budget, output_measure)#

Returns a measurement to launch a DecoratedQueryable.

Returned DecoratedQueryable allows transforming the private data and answering non-interactive MeasurementQuerys as long as the cumulative privacy budget spent does not exceed privacy_budget.

Parameters:
Return type:

DecorateQueryable

Classes#

Queryable

Base class for Queryables.

MeasurementQuery

Contains a Measurement and the d_out it satisfies.

TransformationQuery

Contains a Transformation and the d_out it satisfies.

IndexQuery

Contains the index of measurement to be answered.

RetireQuery

Query for retiring a RetirableQueryable.

RetirableQueryable

Wraps another Queryable and allows retiring all descendant Queryables.

SequentialQueryable

Answers interactive measurement queries sequentially.

ParallelQueryable

Answers index queries on partitions.

GetAnswerQueryable

Returns answer obtained from a non-interactive measurement.

DecoratedQueryable

Allows modifying the query to and the answer from a Queryable.

DecorateQueryable

Creates a DecoratedQueryable.

SequentialComposition

Creates a SequentialQueryable.

ParallelComposition

Creates a ParallelQueryable.

MakeInteractive

Creates a GetAnswerQueryable.

PrivacyAccountantState

All possible states for a PrivacyAccountant.

PrivacyAccountant

An interface for adaptively composing measurements across transformed datasets.

class Queryable#

Bases: abc.ABC

Base class for Queryables.

Note

All subclasses of Queryable should have exactly one public method: __call__.

abstract __call__(query)#

Returns answer to given query.

Parameters:

query (Any)

Return type:

Any

class MeasurementQuery#

Contains a Measurement and the d_out it satisfies.

Note

The d_in is known by the Queryable.

Used by

measurement: tmlt.core.measurements.base.Measurement#

The measurement to answer.

d_out: Any | None = None#

The output measure value satisfied by measurement.

It is only required if the measurement’s privacy_function() raises NotImplementedError.

class TransformationQuery#

Contains a Transformation and the d_out it satisfies.

Note

The d_in is known by the Queryable.

Used by

transformation: tmlt.core.transformations.base.Transformation#

The transformation to apply.

d_out: Any | None = None#

The output metric value satisfied by the transformation.

It is only required if the transformations’s Transformation.stability_function() raises NotImplementedError.

class IndexQuery#

Contains the index of measurement to be answered.

Used by

class RetireQuery#

Query for retiring a RetirableQueryable.

Used by

class RetirableQueryable(queryable)#

Bases: Queryable

Wraps another Queryable and allows retiring all descendant Queryables.

A RetirableQueryable can be initialized with any instance of Queryable and can be in one of two internal states: “active” or “retired”.

All descendant Queryables of a RetirableQueryable are instances of RetirableQueryable. The __call__ method on RetirableQueryable accepts a special RetireQuery query that retires itself and all descendant Queryables.

Submitting a query q to a RetirableQueryable RQ has the following behavior:

  • If q is a RetireQuery, RQ submits a RetireQuery to each child RetirableQueryable, changes its state to “retired”, and returns None.

  • If q is not a RetireQuery and RQ is “active”, it obtains an answer A by submitting q to its inner Queryable.

    • If A is not a Queryable, RQ returns A.

    • Otherwise, RQ constructs and returns a new RetirableQueryable with Queryable A.

  • If q is not a RetireQuery and RQ is “retired”, an error is raised.

Parameters:

queryable (Queryable)

__init__(queryable)#

Constructor.

Arg:

queryable: Queryable to be wrapped.

Parameters:

queryable (Queryable)

__call__(query)#

Answers query.

If query is RetireQuery, this queryable and all descendant queryables are retired. Otherwise, the query is routed to the wrapped queryable.

Parameters:

query (Any)

Return type:

Any

class SequentialQueryable(input_domain, input_metric, d_in, output_measure, privacy_budget, data)#

Bases: Queryable

Answers interactive measurement queries sequentially.

All interactions with a Queryable obtained from answering an interactive measurement must be completed before a second interactive measurement can be answered.

Parameters:
__init__(input_domain, input_metric, d_in, output_measure, privacy_budget, data)#

Constructor.

Parameters:
__call__(query)#

Answers the query.

Parameters:

query (Union[MeasurementQuery, TransformationQuery])

Return type:

Optional[RetirableQueryable]

class ParallelQueryable(data, measurements)#

Bases: Queryable

Answers index queries on partitions.

Parameters:
__init__(data, measurements)#

Constructor.

Parameters:
  • data (List) – Data being queried.

  • measurements (List[Measurement]) – List of measurements to be answered on each list element.

__call__(query)#

Answers IndexQuerys.

Parameters:

query (IndexQuery)

Return type:

Any

class GetAnswerQueryable(measurement, data)#

Bases: Queryable

Returns answer obtained from a non-interactive measurement.

Parameters:
__init__(measurement, data)#

Constructor.

Parameters:
__call__(query)#

Returns answer.

Parameters:

query (None)

Return type:

Any

class DecoratedQueryable(queryable, preprocess_query, postprocess_answer)#

Bases: Queryable

Allows modifying the query to and the answer from a Queryable.

The privacy guarantee for DecoratedQueryable depends on the passed function postprocess_answer satisfying certain properties. In particular, postprocess_answer should not use distinguishing pseudo-side channel information, and should be well-defined on its abstract domain. See Postprocessing udfs and pseudo-side channel information.

Parameters:
  • queryable (Queryable)

  • preprocess_query (Callable[[Any], Any])

  • postprocess_answer (Callable[[Any], Any])

__init__(queryable, preprocess_query, postprocess_answer)#

Constructor.

Parameters:
__call__(query)#

Answers query.

Parameters:

query (Any)

Return type:

Any

class DecorateQueryable(measurement, preprocess_query, postprocess_answer)#

Bases: tmlt.core.measurements.base.Measurement

Creates a DecoratedQueryable.

This class allows preprocessing queries to a Queryable launched by another interactive measurement as well as post-processing answers produced by the Queryable.

Parameters:
property measurement: tmlt.core.measurements.base.Measurement#

Returns wrapped Measurement.

Return type:

tmlt.core.measurements.base.Measurement

property preprocess_query: Callable[[Any], Any]#

Returns function to preprocess queries.

Return type:

Callable[[Any], Any]

property postprocess_answer: Callable[[Any], Any]#

Returns function to postprocess answers.

Return type:

Callable[[Any], Any]

property input_domain: tmlt.core.domains.base.Domain#

Return input domain for the measurement.

Return type:

tmlt.core.domains.base.Domain

property input_metric: tmlt.core.metrics.Metric#

Distance metric on input domain.

Return type:

tmlt.core.metrics.Metric

property output_measure: tmlt.core.measures.Measure#

Distance measure on output.

Return type:

tmlt.core.measures.Measure

property is_interactive: bool#

Returns true iff the measurement is interactive.

Return type:

bool

__init__(measurement, preprocess_query, postprocess_answer)#

Constructor.

Parameters:
  • measurement (Measurement) – Interactive measurement to decorate.

  • preprocess_query (Callable[[Any], Any]) – Function to preprocess queries submitted to the Queryable obtained by running this measurement.

  • postprocess_answer (Callable[[Any], Any]) – Function to process answers produced by the Queryable returned by this measurement.

privacy_function(d_in)#

Returns the smallest d_out satisfied by the measurement.

Parameters:

d_in (Any)

Return type:

Any

__call__(data)#

Returns a DecoratedQueryable.

Parameters:

data (Any)

Return type:

DecoratedQueryable

privacy_relation(d_in, d_out)#

Return True if close inputs produce close outputs.

See the privacy and stability tutorial (add link?) for more information.

Parameters:
  • d_in (Any) – Distance between inputs under input_metric.

  • d_out (Any) – Distance between outputs under output_measure.

Return type:

bool

class SequentialComposition(input_domain, input_metric, output_measure, d_in, privacy_budget)#

Bases: tmlt.core.measurements.base.Measurement

Creates a SequentialQueryable.

This class allows for measurements to be answered interactively using a cumulative privacy budget.

The main restriction, which is enforced by the returned SequentialQueryable, is that interactive measurements cannot be freely interleaved.

Parameters:
property d_in: Any#

Returns the distance between input datasets.

Return type:

Any

property privacy_budget: tmlt.core.measures.PrivacyBudgetValue#

Total privacy budget across all measurements.

Return type:

tmlt.core.measures.PrivacyBudgetValue

property output_measure: tmlt.core.measures.PureDP | tmlt.core.measures.ApproxDP | tmlt.core.measures.RhoZCDP#

Return output measure for the measurement.

Return type:

Union[tmlt.core.measures.PureDP, tmlt.core.measures.ApproxDP, tmlt.core.measures.RhoZCDP]

property input_domain: tmlt.core.domains.base.Domain#

Return input domain for the measurement.

Return type:

tmlt.core.domains.base.Domain

property input_metric: tmlt.core.metrics.Metric#

Distance metric on input domain.

Return type:

tmlt.core.metrics.Metric

property is_interactive: bool#

Returns true iff the measurement is interactive.

Return type:

bool

__init__(input_domain, input_metric, output_measure, d_in, privacy_budget)#

Constructor.

Parameters:
privacy_function(d_in)#

Returns the smallest d_out satisfied by the measurement.

The returned d_out is the privacy_budget.

Parameters:

d_in (Any) – Distance between inputs under input_metric. Must be less than or equal to the d_in the measurement was created with.

Return type:

tmlt.core.measures.PrivacyBudgetValue

__call__(data)#

Returns a Queryable object on input data.

Parameters:

data (Any)

Return type:

SequentialQueryable

privacy_relation(d_in, d_out)#

Return True if close inputs produce close outputs.

See the privacy and stability tutorial (add link?) for more information.

Parameters:
  • d_in (Any) – Distance between inputs under input_metric.

  • d_out (Any) – Distance between outputs under output_measure.

Return type:

bool

class ParallelComposition(input_domain, input_metric, output_measure, measurements)#

Bases: tmlt.core.measurements.base.Measurement

Creates a ParallelQueryable.

This class allows for answering measurements on objects in some ListDomain which have a SumOf or RootSumOfSquared input metric, such as after a partition.

The main restriction, which is enforced by the returned ParallelQueryable, is that partitions can only be accessed in the sequence that they appear in the list.

Parameters:
property measurements: List[tmlt.core.measurements.base.Measurement]#

Returns list of composed measurements.

Return type:

List[tmlt.core.measurements.base.Measurement]

property input_domain: tmlt.core.domains.base.Domain#

Return input domain for the measurement.

Return type:

tmlt.core.domains.base.Domain

property input_metric: tmlt.core.metrics.Metric#

Distance metric on input domain.

Return type:

tmlt.core.metrics.Metric

property output_measure: tmlt.core.measures.Measure#

Distance measure on output.

Return type:

tmlt.core.measures.Measure

property is_interactive: bool#

Returns true iff the measurement is interactive.

Return type:

bool

__init__(input_domain, input_metric, output_measure, measurements)#

Constructor.

Parameters:
  • input_domain (ListDomain) – Domain of input lists.

  • input_metric (Union[SumOf, RootSumOfSquared]) – Distance metric for input lists.

  • output_measure (Union[PureDP, ApproxDP, RhoZCDP]) – Distance measure for measurement’s output.

  • measurements (List[Measurement]) – List of measurements to be applied to the corresponding elements in the input list. The length of this list must match the length of lists in the input_domain.

privacy_function(d_in)#

Returns the smallest d_out satisfied by the measurement.

Returns the largest d_out from the privacy_function() of all of the composed measurements.

Parameters:

d_in (Any) – Distance between inputs under input_metric.

Raises:

NotImplementedError – If any of the composed measurements’ privacy_relation() raise NotImplementedError.

Return type:

tmlt.core.measures.PrivacyBudgetValue

__call__(data)#

Returns a ParallelQueryable.

Parameters:

data (Any)

Return type:

ParallelQueryable

privacy_relation(d_in, d_out)#

Return True if close inputs produce close outputs.

See the privacy and stability tutorial (add link?) for more information.

Parameters:
  • d_in (Any) – Distance between inputs under input_metric.

  • d_out (Any) – Distance between outputs under output_measure.

Return type:

bool

class MakeInteractive(measurement)#

Bases: tmlt.core.measurements.base.Measurement

Creates a GetAnswerQueryable.

This allows submitting non-interactive measurements as interactive measurement queries to SequentialQueryable and ParallelQueryable.

Parameters:

measurement (tmlt.core.measurements.base.Measurement)

property measurement: tmlt.core.measurements.base.Measurement#

Returns wrapped non-interactive measurement.

Return type:

tmlt.core.measurements.base.Measurement

property input_domain: tmlt.core.domains.base.Domain#

Return input domain for the measurement.

Return type:

tmlt.core.domains.base.Domain

property input_metric: tmlt.core.metrics.Metric#

Distance metric on input domain.

Return type:

tmlt.core.metrics.Metric

property output_measure: tmlt.core.measures.Measure#

Distance measure on output.

Return type:

tmlt.core.measures.Measure

property is_interactive: bool#

Returns true iff the measurement is interactive.

Return type:

bool

__init__(measurement)#

Constructor.

Parameters:

measurement (Measurement) – Non-interactive measurement to be wrapped.

privacy_function(d_in)#

Returns the smallest d_out satisfied by the measurement.

Parameters:

d_in (Any)

Return type:

Any

privacy_relation(d_in, d_out)#

Returns True only if wrapped measurement’s privacy relation is satisfied.

Parameters:
  • d_in (Any)

  • d_out (Any)

Return type:

Any

__call__(data)#

Returns a GetAnswerQueryable.

Parameters:

data (Any)

Return type:

GetAnswerQueryable

class PrivacyAccountantState#

Bases: enum.Enum

All possible states for a PrivacyAccountant.

ACTIVE = 1#

The PrivacyAccountant is active and can perform actions.

This is the default state of a PrivacyAccountant constructed by calling launch().

A PrivacyAccountant can only perform actions if it is ACTIVE.

Transitioning to ACTIVE:

A PrivacyAccountant that is WAITING_FOR_SIBLING will become ACTIVE if

A PrivacyAccountant that is WAITING_FOR_CHILDREN will become ACTIVE if

  • all of its children are RETIRED

  • force_activate() is called.

    • This will retire all of its descendants

WAITING_FOR_SIBLING = 2#

The PrivacyAccountant is waiting for the preceding sibling to retire.

This is the default state of all but the first PrivacyAccountant created by split(). PrivacyAccountants obtained by calling split() must be activated in the same order that they appear in the list.

WAITING_FOR_CHILDREN = 3#

The PrivacyAccountant has children who have not been retired.

Transitioning to WAITING_FOR_CHILDREN:

A PrivacyAccountant that is ACTIVE will become WAITING_FOR_CHILDREN if

RETIRED = 4#

The PrivacyAccountant can no longer perform actions.

Transitioning to RETIRED:

A PrivacyAccountant that is WAITING_FOR_SIBLING or ACTIVE will become RETIRED if

Note

If a PrivacyAccountant is retired while it is WAITING_FOR_SIBLING (before it has performed any actions), a RuntimeWarning is raised.

A PrivacyAccountant that is WAITING_FOR_CHILDREN will become RETIRED when

class PrivacyAccountant(queryable, input_domain, input_metric, output_measure, d_in, privacy_budget, parent=None)#

An interface for adaptively composing measurements across transformed datasets.

PrivacyAccountant supports multiple actions to answer measurements and transform data.

Calling any of the following methods is considered an action:

To preserve privacy, after children are created (using split()), there are restrictions on the order of interactions among the PrivacyAccountant and its descendants. See PrivacyAccountantState for more information.

Parameters:
property input_domain: tmlt.core.domains.base.Domain#

Returns the domain of the private data.

Return type:

tmlt.core.domains.base.Domain

property input_metric: tmlt.core.metrics.Metric#

Returns the distance metric for neighboring datasets.

Return type:

tmlt.core.metrics.Metric

property output_measure: tmlt.core.measures.PureDP | tmlt.core.measures.ApproxDP | tmlt.core.measures.RhoZCDP#

Returns the output measure for measurement outputs.

Return type:

Union[tmlt.core.measures.PureDP, tmlt.core.measures.ApproxDP, tmlt.core.measures.RhoZCDP]

property d_in: Any#

Returns the distance for neighboring datasets.

Return type:

Any

property privacy_budget: tmlt.core.measures.PrivacyBudgetValue#

Returns the remaining privacy budget.

Return type:

tmlt.core.measures.PrivacyBudgetValue

property state: PrivacyAccountantState#

Returns this PrivacyAccountant’s current state.

See PrivacyAccountantState for more information.

Return type:

PrivacyAccountantState

property parent: PrivacyAccountant | None#

Returns the parent of this PrivacyAccountant.

If this is the root PrivacyAccountant, this returns None.

Return type:

Optional[PrivacyAccountant]

property children: List[PrivacyAccountant]#

Returns the children of this PrivacyAccountant.

Children are created by calling split().

Return type:

List[PrivacyAccountant]

__init__(queryable, input_domain, input_metric, output_measure, d_in, privacy_budget, parent=None)#

Constructor.

Note

A PrivacyAccountant should be constructed using launch(). Do not use the constructor directly.

Parameters:
static launch(measurement, data)#

Returns a PrivacyAccountant from a measurement and data.

The returned PrivacyAccountant is ACTIVE and has no parent.

Example

>>> measurement = SequentialComposition(
...     input_domain=SparkDataFrameDomain(
...         {
...             "A": SparkIntegerColumnDescriptor(),
...             "B": SparkStringColumnDescriptor(),
...         }
...     ),
...     input_metric=SymmetricDifference(),
...     output_measure=PureDP(),
...     d_in=1,
...     privacy_budget=5,
... )
>>> privacy_accountant = PrivacyAccountant.launch(measurement, dataframe)
>>> privacy_accountant.state
<PrivacyAccountantState.ACTIVE: 1>
>>> privacy_accountant.output_measure
PureDP()
>>> privacy_accountant.privacy_budget
5
>>> print(privacy_accountant.parent)
None
Parameters:
Return type:

PrivacyAccountant

transform_in_place(transformation, d_out=None)#

Transforms the private data inside this PrivacyAccountant.

This method is an action.

Requirements to apply transformation:

After applying transformation:

Example

>>> privacy_accountant.input_domain
NumpyIntegerDomain(size=64)
>>> privacy_accountant.input_metric
AbsoluteDifference()
>>> privacy_accountant.output_measure
PureDP()
>>> privacy_accountant.d_in
2
>>> privacy_accountant.privacy_budget
5
>>> transformation = CreateDictFromValue(
...     input_domain=NumpyIntegerDomain(),
...     input_metric=AbsoluteDifference(),
...     key="A",
... )
>>> privacy_accountant.transform_in_place(transformation)
>>> privacy_accountant.input_domain
DictDomain(key_to_domain={'A': NumpyIntegerDomain(size=64)})
>>> privacy_accountant.input_metric
DictMetric(key_to_metric={'A': AbsoluteDifference()})
>>> privacy_accountant.output_measure
PureDP()
>>> privacy_accountant.d_in
{'A': 2}
>>> privacy_accountant.privacy_budget
5
Parameters:
Raises:

InactiveAccountantError – If this PrivacyAccountant is not ACTIVE.

Return type:

None

measure(measurement, d_out=None)#

Returns the answer to measurement.

This method is an action.

Requirements to answer measurement:

After answering measurement:

Example

>>> privacy_accountant.input_domain
NumpyIntegerDomain(size=64)
>>> privacy_accountant.input_metric
AbsoluteDifference()
>>> privacy_accountant.output_measure
PureDP()
>>> privacy_accountant.d_in
2
>>> privacy_accountant.privacy_budget
5
>>> noise_scale = calculate_noise_scale(
...     d_in=2,
...     d_out=3,
...     output_measure=PureDP(),
... )
>>> measurement = AddLaplaceNoise(
...     input_domain=NumpyIntegerDomain(),
...     scale=noise_scale,
... )
>>> privacy_accountant.measure(measurement) 

...
>>> privacy_accountant.input_domain
NumpyIntegerDomain(size=64)
>>> privacy_accountant.input_metric
AbsoluteDifference()
>>> privacy_accountant.output_measure
PureDP()
>>> privacy_accountant.d_in
2
>>> privacy_accountant.privacy_budget
2
Parameters:
Raises:

InactiveAccountantError – If this PrivacyAccountant is not ACTIVE.

Return type:

Any

split(splitting_transformation, privacy_budget, d_out=None)#

Returns new PrivacyAccountants from splitting the private data.

Uses splitting_transformation to split the private data into a list of new datasets. A new PrivacyAccountant is returned for each element in the list created by splitting_transformation.

Note

Unlike transform_in_place(), this does not transform the private data in this PrivacyAccountant.

This method is an action.

Requirements to split:

After creating the new PrivacyAccountants:

Note

After creating children, the state will change to WAITING_FOR_CHILDREN, until the children are all RETIRED.

Example

>>> privacy_accountant.input_domain
DictDomain(key_to_domain={'A': ListDomain(element_domain=NumpyIntegerDomain(size=64), length=3)})
>>> privacy_accountant.input_metric
DictMetric(key_to_metric={'A': SumOf(inner_metric=AbsoluteDifference())})
>>> privacy_accountant.output_measure
PureDP()
>>> privacy_accountant.d_in
{'A': 2}
>>> privacy_accountant.privacy_budget
5
>>> privacy_accountant.state
<PrivacyAccountantState.ACTIVE: 1>
>>> splitting_transformation = GetValue(
...     input_domain=DictDomain(
...         key_to_domain={
...             "A": ListDomain(
...                 element_domain=NumpyIntegerDomain(),
...                 length=3,
...             ),
...         }
...     ),
...     input_metric=DictMetric(
...         key_to_metric={"A": SumOf(inner_metric=AbsoluteDifference())}
...     ),
...     key="A",
... )
>>> children = privacy_accountant.split(
...     splitting_transformation=splitting_transformation,
...     privacy_budget=3,
... )
>>> privacy_accountant.input_domain
DictDomain(key_to_domain={'A': ListDomain(element_domain=NumpyIntegerDomain(size=64), length=3)})
>>> privacy_accountant.input_metric
DictMetric(key_to_metric={'A': SumOf(inner_metric=AbsoluteDifference())})
>>> privacy_accountant.output_measure
PureDP()
>>> privacy_accountant.d_in
{'A': 2}
>>> privacy_accountant.privacy_budget
2
>>> privacy_accountant.state
<PrivacyAccountantState.WAITING_FOR_CHILDREN: 3>
>>> children[0].input_domain
NumpyIntegerDomain(size=64)
>>> children[0].input_metric
AbsoluteDifference()
>>> children[0].output_measure
PureDP()
>>> children[0].d_in
2
>>> children[0].privacy_budget
3
>>> # The first child is ACTIVE
>>> children[0].state
<PrivacyAccountantState.ACTIVE: 1>
>>> # The other children are WAITING_FOR_SIBLING
>>> children[1].state
<PrivacyAccountantState.WAITING_FOR_SIBLING: 2>
>>> children[2].state
<PrivacyAccountantState.WAITING_FOR_SIBLING: 2>
>>> # When the first child is RETIRED, the second child becomes ACTIVE
>>> children[0].retire()
>>> children[0].state
<PrivacyAccountantState.RETIRED: 4>
>>> children[1].state
<PrivacyAccountantState.ACTIVE: 1>
>>> # When all children are RETIRED, the parent transitions from
>>> # WAITING_FOR_CHILDREN to ACTIVE
>>> children[1].retire()
>>> children[2].retire()
>>> privacy_accountant.state
<PrivacyAccountantState.ACTIVE: 1>
Parameters:
Raises:

InactiveAccountantError – If this PrivacyAccountant is not ACTIVE.

Return type:

List[PrivacyAccountant]

force_activate()#

Set this PrivacyAccountant’s state to ACTIVE.

A PrivacyAccountant must be ACTIVE to perform actions

See PrivacyAccountantState for more information.

If this PrivacyAccountant is WAITING_FOR_SIBLING, it retires all preceding siblings. If this PrivacyAccountant is WAITING_FOR_CHILDREN it retires all of its descendants.

Raises:

RuntimeError – If this PrivacyAccountant is RETIRED.

Return type:

None

retire(force=False)#

Set this PrivacyAccountant’s state to RETIRED.

If this PrivacyAccountant is WAITING_FOR_SIBLING, it also retires all preceding siblings and their descendants. If this PrivacyAccountant is WAITING_FOR_CHILDREN it also retires all of its descendants.

A RETIRED PrivacyAccountant cannot perform actions, but its properties can still be inspected.

See PrivacyAccountantState for more information.

Parameters:

force (bool) – Whether this PrivacyAccountant can retire its descendants if this PrivacyAccountant is WAITING_FOR_CHILDREN.

Raises:
Return type:

None

queue_transformation(transformation, d_out=None)#

Queue transformation to be executed when this PrivacyAccountant becomes ACTIVE.

If this PrivacyAccountant is ACTIVE, this has the same behavior as transform_in_place().

If this PrivacyAccountant is WAITING_FOR_CHILDREN or WAITING_FOR_SIBLING, transformation will be applied to the private data when this PrivacyAccountant becomes ACTIVE, but otherwise it has the same behavior as transform_in_place() (input_domain, input_metric, and d_in are updated immediately).

Note that multiple transformations can be queued.

Parameters:
Return type:

None

Exceptions#

exception InactiveAccountantError#

Bases: RuntimeError

Raised when trying to perform operations on an accountant that is not ACTIVE.

PrivacyAccountant will raise this exception if you attempt an operation and the accountant is not ACTIVE.