_compiler#

Defines QueryExprCompiler for building transformations from query exprs.

Data#

DEFAULT_MECHANISM = DEFAULT#

Constant used for DEFAULT noise mechanism

LAPLACE_MECHANISM = LAPLACE#

Constant used for LAPLACE noise mechanism

GAUSSIAN_MECHANISM = GAUSSIAN#

Constant used for GAUSSIAN noise mechanism

Classes#

QueryExprCompiler

Compiles a list of query expressions to a single measurement object.

class QueryExprCompiler(output_measure=PureDP())#

Compiles a list of query expressions to a single measurement object.

Requires that each query is a groupby-aggregation on a sequence of transformations on a PrivateSource or PrivateView. If there is a PrivateView, the stability of the view is handled when the noise scale is calculated.

A QueryExprCompiler object compiles a list of QueryExpr objects into a single object (based on the privacy framework). The Measurement object can be run with a private data source to obtain DP answers to supplied queries.

Supported QueryExprs:

Parameters

output_measure (Union[tmlt.core.measures.PureDP, tmlt.core.measures.ApproxDP, tmlt.core.measures.RhoZCDP]) –

__init__(output_measure=PureDP())#

Constructor.

Parameters

output_measure (PureDP | ApproxDP | RhoZCDPUnion[PureDP, ApproxDP, RhoZCDP] (default: PureDP())) – Distance measure for measurement’s output.

property mechanism#

Return the value of Core noise mechanism.

Return type

tmlt.core.measurements.aggregations.NoiseMechanism

property output_measure#

Return the distance measure for the measurement’s output.

Return type

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

static query_schema(query, catalog)#

Return the schema created by a given query.

Parameters
Return type

tmlt.analytics._schema.Schema

__call__(queries, privacy_budget, stability, input_domain, input_metric, public_sources, catalog, table_constraints)#

Returns a compiled DP measurement and its noise information.

Parameters
Return type

Tuple[tmlt.core.measurements.base.Measurement, tmlt.analytics._noise_info.NoiseInfo]

build_transformation(query, input_domain, input_metric, public_sources, catalog, table_constraints)#

Returns a transformation and reference for the query.

Supported QueryExprs:

Parameters
Return type

Tuple[tmlt.core.transformations.base.Transformation, tmlt.analytics._table_reference.TableReference, List[tmlt.analytics.constraints.Constraint]]