Package 'opendp'

Title: R Bindings for the OpenDP Library
Description: The OpenDP Library is a modular collection of statistical algorithms that adhere to the definition of differential privacy. It can be used to build applications of privacy-preserving computations, using a number of different models of privacy.
Authors: Stefano Iacus [cre], The OpenDP Project [aut] (https://github.com/opendp/opendp/graphs/contributors), The authors of the dependency Rust crates [ctb] (see inst/AUTHORS file for details)
Maintainer: Stefano Iacus <[email protected]>
License: MIT + file LICENSE
Version: 0.15.1
Built: 2026-05-29 05:24:31 UTC
Source: https://github.com/opendp/opendp

Help Index


Construct an instance of the AbsoluteDistance metric.

Description

absolute_distance in Rust documentation.

Usage

absolute_distance(.T)

Arguments

.T

undocumented

Value

Metric


Convert a desired accuracy (tolerance) into a discrete gaussian noise scale at a statistical significance level alpha.

Description

accuracy_to_discrete_gaussian_scale in Rust documentation.

Usage

accuracy_to_discrete_gaussian_scale(accuracy, alpha, .T = NULL)

Arguments

accuracy

Desired accuracy. A tolerance for how far values may diverge from the input to the mechanism.

alpha

Statistical significance, level-alpha, or (1. - alpha)100% confidence. Must be within (0, 1].

.T

Data type of accuracy and alpha

Details

Proof Definition:

(Proof Document)


Convert a desired accuracy (tolerance) into a discrete Laplacian noise scale at a statistical significance level alpha.

Description

accuracy_to_discrete_laplacian_scale in Rust documentation.

Usage

accuracy_to_discrete_laplacian_scale(accuracy, alpha, .T = NULL)

Arguments

accuracy

Desired accuracy. A tolerance for how far values may diverge from the input to the mechanism.

alpha

Statistical significance, level-alpha, or (1. - alpha)100% confidence. Must be within (0, 1].

.T

Data type of accuracy and alpha

Details

Proof Definition:

(Proof Document)

Value

Discrete laplacian noise scale that meets the accuracy requirement at a given level-alpha.


Convert a desired accuracy (tolerance) into a gaussian noise scale at a statistical significance level alpha.

Description

accuracy_to_gaussian_scale in Rust documentation.

Usage

accuracy_to_gaussian_scale(accuracy, alpha, .T = NULL)

Arguments

accuracy

Desired accuracy. A tolerance for how far values may diverge from the input to the mechanism.

alpha

Statistical significance, level-alpha, or (1. - alpha)100% confidence. Must be within (0, 1].

.T

Data type of accuracy and alpha


Convert a desired accuracy (tolerance) into a Laplacian noise scale at a statistical significance level alpha.

Description

accuracy_to_laplacian_scale in Rust documentation.

Usage

accuracy_to_laplacian_scale(accuracy, alpha, .T = NULL)

Arguments

accuracy

Desired accuracy. A tolerance for how far values may diverge from the input to the mechanism.

alpha

Statistical significance, level-alpha, or (1. - alpha)100% confidence. Must be within (0, 1].

.T

Data type of accuracy and alpha

Value

Laplacian noise scale that meets the accuracy requirement at a given level-alpha.


Privacy measure used to define δ\delta-approximate PM-differential privacy.

Description

In the following definition, dd corresponds to privacy parameters (d,δ)(d', \delta) when also quantified over all adjacent datasets (dd' is the privacy parameter corresponding to privacy measure PM). That is, (d,δ)(d', \delta) is no smaller than dd (by product ordering), over all pairs of adjacent datasets x,xx, x' where YM(x)Y \sim M(x), YM(x)Y' \sim M(x'). M()M(\cdot) is a measurement (commonly known as a mechanism). The measurement's input metric defines the notion of adjacency, and the measurement's input domain defines the set of possible datasets.

Usage

approximate(measure)

Arguments

measure

inner privacy measure

Details

approximate in Rust documentation.

Proof Definition:

For any two distributions Y,YY, Y' and 2-tuple d=(d,δ)d = (d', \delta), where dd' is the distance with respect to privacy measure PM, Y,YY, Y' are dd-close under the approximate PM measure whenever, for any choice of δ[0,1]\delta \in [0, 1], there exist events EE (depending on YY) and EE' (depending on YY') such that Pr[E]1δ\Pr[E] \ge 1 - \delta, Pr[E]1δ\Pr[E'] \ge 1 - \delta, and

DPMδ(YE,YE)=DPM(YE,YE)D_{\mathrm{PM}}^\delta(Y|_E, Y'|_{E'}) = D_{\mathrm{PM}}(Y|_E, Y'|_{E'})

where YEY|_E denotes the distribution of YY conditioned on the event EE.

Note that this δ\delta is not privacy parameter δ\delta until quantified over all adjacent datasets, as is done in the definition of a measurement.

Value

ApproximateDivergence


Construct an instance of AtomDomain.

Description

The domain defaults to unbounded if bounds is None, If T is float, nan defaults to true.

Usage

atom_domain(bounds = NULL, nan = NULL, .T = NULL)

Arguments

bounds

Optional bounds of elements in the domain, if the data type is numeric.

nan

Whether the domain may contain NaN, if the data type is float.

.T

The type of the atom.

Details

atom_domain in Rust documentation.

Value

AtomDomain

Examples

atom_domain(.T = "i32")

Find the highest-utility (d_in, d_out)-close Transformation or Measurement.

Description

Searches for the numeric parameter to make_chain that results in a computation that most tightly satisfies d_out when datasets differ by at most d_in, then returns the Transformation or Measurement corresponding to said parameter.

Usage

binary_search_chain(make_chain, d_in, d_out, bounds = NULL, .T = NULL)

Arguments

make_chain

a function that takes a number and returns a Transformation or Measurement

d_in

how far apart input datasets can be

d_out

how far apart output datasets or distributions can be

bounds

a 2-tuple of the lower and upper bounds on the input of make_chain

.T

type of argument to make_chain, either "float" or "int"

Details

See binary_search_param to retrieve the discovered parameter instead of the complete computation chain.

Value

a Transformation or Measurement (chain) that is (d_in, d_out)-close.

Examples

enable_features("contrib")
# create a sum transformation over the space of float vectors
s_vec <- c(vector_domain(atom_domain(.T = "float", nan = FALSE)), symmetric_distance())
t_sum <- s_vec |> then_clamp(c(0., 1.)) |> then_sum()

# find a measurement that satisfies epsilon = 1 when datasets differ by at most one record
m_sum <- binary_search_chain(\(s) t_sum |> then_laplace(s), d_in = 1L, d_out = 1.)

Solve for the ideal constructor argument to make_chain

Description

Searches for the numeric parameter to make_chain that results in a computation that most tightly satisfies d_out when datasets differ by at most d_in.

Usage

binary_search_param(make_chain, d_in, d_out, bounds = NULL, .T = NULL)

Arguments

make_chain

a function that takes a number and returns a Transformation or Measurement

d_in

how far apart input datasets can be

d_out

how far apart output datasets or distributions can be

bounds

a 2-tuple of the lower and upper bounds on the input of make_chain

.T

type of argument to make_chain, either "float" or "int"

Value

the parameter to make_chain that results in a (d_in, d_out)-close Transformation or Measurement


type signature for a BitVector

Description

type signature for a BitVector

Usage

BitVector

Construct an instance of BitVectorDomain.

Description

Construct an instance of BitVectorDomain.

Usage

bitvector_domain(max_weight = NULL)

Arguments

max_weight

The maximum number of positive bits.

Value

Domain


type signature for a boolean

Description

type signature for a boolean

Usage

bool

Construct an instance of the ChangeOneDistance metric.

Description

Construct an instance of the ChangeOneDistance metric.

Usage

change_one_distance()

Value

Metric


Returns an approximation to the ideal branching_factor for a dataset of a given size, that minimizes error in cdf and quantile estimates based on b-ary trees.

Description

Required features: contrib

Usage

choose_branching_factor(size_guess)

Arguments

size_guess

A guess at the size of your dataset.

Details

choose_branching_factor in Rust documentation.

Citations:

Value

int


Disable features in the opendp package.

Description

Disable features in the opendp package.

Usage

disable_features(...)

Arguments

...

features to disable


Construct an instance of the DiscreteDistance metric.

Description

Construct an instance of the DiscreteDistance metric.

Usage

discrete_distance()

Value

Metric


Convert a discrete gaussian scale into an accuracy estimate (tolerance) at a statistical significance level alpha.

Description

discrete_gaussian_scale_to_accuracy in Rust documentation.

Usage

discrete_gaussian_scale_to_accuracy(scale, alpha, .T = NULL)

Arguments

scale

Gaussian noise scale.

alpha

Statistical significance, level-alpha, or (1. - alpha)100% confidence. Must be within (0, 1].

.T

Data type of scale and alpha

Details

Proof Definition:

(Proof Document)


Convert a discrete Laplacian scale into an accuracy estimate (tolerance) at a statistical significance level alpha.

Description

α=P[Yaccuracy]\alpha = P[Y \ge accuracy], where Y=XzY = | X - z |, and XLZ(0,scale)X \sim \mathcal{L}_{Z}(0, scale). That is, XX is a discrete Laplace random variable and YY is the distribution of the errors.

Usage

discrete_laplacian_scale_to_accuracy(scale, alpha, .T = NULL)

Arguments

scale

Discrete Laplacian noise scale.

alpha

Statistical significance, level-alpha, or (1. - alpha)100% confidence. Must be within (0, 1].

.T

Data type of scale and alpha

Details

This function returns a float accuracy. You can take the floor without affecting the coverage probability.

discrete_laplacian_scale_to_accuracy in Rust documentation.

Proof Definition:

(Proof Document)


Get the carrier type of a domain.

Description

Get the carrier type of a domain.

Usage

domain_carrier_type(this)

Arguments

this

The domain to retrieve the carrier type from.

Value

str


Debug a domain.

Description

Debug a domain.

Usage

domain_debug(this)

Arguments

this

The domain to debug (stringify).

Value

str


Get the type of a domain.

Description

Get the type of a domain.

Usage

domain_type(this)

Arguments

this

The domain to retrieve the type from.

Value

str


Enable features for the opendp package.

Description

See https://github.com/opendp/opendp/discussions/304 for available features.

Usage

enable_features(...)

Arguments

...

features to enable


type signature for an arbitrary R object preserved across FFI

Description

type signature for an arbitrary R object preserved across FFI

Usage

ExtrinsicObject

type signature for a 32-bit floating point number

Description

type signature for a 32-bit floating point number

Usage

f32

type signature for a 64-bit floating point number

Description

type signature for a 64-bit floating point number

Usage

f64

Privacy measure used to define (ϵ,δ)(\epsilon, \delta)-approximate differential privacy.

Description

In the following definition, dd corresponds to (ϵ,δ)(\epsilon, \delta) when also quantified over all adjacent datasets. That is, (ϵ,δ)(\epsilon, \delta) is no smaller than dd (by product ordering), over all pairs of adjacent datasets x,xx, x' where YM(x)Y \sim M(x), YM(x)Y' \sim M(x'). M()M(\cdot) is a measurement (commonly known as a mechanism). The measurement's input metric defines the notion of adjacency, and the measurement's input domain defines the set of possible datasets.

Usage

fixed_smoothed_max_divergence()

Details

Proof Definition:

For any two distributions Y,YY, Y' and any 2-tuple dd of non-negative numbers ϵ\epsilon and δ\delta, Y,YY, Y' are dd-close under the fixed smoothed max divergence measure whenever

Dδ(Y,Y)=maxSSupp(Y)[lnPr[YS]+δPr[YS]]ϵD_\infty^\delta(Y, Y') = \max_{S \subseteq \textrm{Supp}(Y)} \Big[\ln \dfrac{\Pr[Y \in S] + \delta}{\Pr[Y' \in S]} \Big] \leq \epsilon.

Note that this ϵ\epsilon and δ\delta are not privacy parameters ϵ\epsilon and δ\delta until quantified over all adjacent datasets, as is done in the definition of a measurement.

Value

Measure


Eval the function with arg.

Description

Eval the function with arg.

Usage

function_eval(this, arg, TI = NULL)

Arguments

this

Function to invoke.

arg

Input data to supply to the measurement. A member of the measurement's input domain.

TI

Input Type.


Convert a gaussian scale into an accuracy estimate (tolerance) at a statistical significance level alpha.

Description

gaussian_scale_to_accuracy in Rust documentation.

Usage

gaussian_scale_to_accuracy(scale, alpha, .T = NULL)

Arguments

scale

Gaussian noise scale.

alpha

Statistical significance, level-alpha, or (1. - alpha)100% confidence. Must be within (0, 1].

.T

Data type of scale and alpha


Construct an instance of the HammingDistance metric.

Description

Construct an instance of the HammingDistance metric.

Usage

hamming_distance()

Value

Metric


extract heterogeneously typed keys and values from a hashtab

Description

extract heterogeneously typed keys and values from a hashtab

Usage

hashitems(data, type_name)

Arguments

data

a hashtab

type_name

the expected runtime_type of the hashtab


type signature for a 128-bit signed integer

Description

type signature for a 128-bit signed integer

Usage

i128

type signature for a 16-bit signed integer

Description

type signature for a 16-bit signed integer

Usage

i16

type signature for a 32-bit signed integer

Description

type signature for a 32-bit signed integer

Usage

i32

type signature for a 64-bit signed integer

Description

type signature for a 64-bit signed integer

Usage

i64

type signature for an 8-bit signed integer

Description

type signature for an 8-bit signed integer

Usage

i8

Construct an instance of the InsertDeleteDistance metric.

Description

Construct an instance of the InsertDeleteDistance metric.

Usage

insert_delete_distance()

Value

Metric


Construct an instance of the L01InfDistance metric.

Description

l01inf_distance in Rust documentation.

Usage

l01inf_distance(metric)

Arguments

metric

The metric used to compute distance between partitions.

Value

Metric


Construct an instance of the L02InfDistance metric.

Description

l02inf_distance in Rust documentation.

Usage

l02inf_distance(metric)

Arguments

metric

The metric used to compute distance between partitions.

Value

Metric


Construct an instance of the L1Distance metric.

Description

l1_distance in Rust documentation.

Usage

l1_distance(.T)

Arguments

.T

undocumented

Value

Metric


Construct an instance of the L2Distance metric.

Description

l2_distance in Rust documentation.

Usage

l2_distance(.T)

Arguments

.T

undocumented

Value

Metric


Convert a Laplacian scale into an accuracy estimate (tolerance) at a statistical significance level alpha.

Description

laplacian_scale_to_accuracy in Rust documentation.

Usage

laplacian_scale_to_accuracy(scale, alpha, .T = NULL)

Arguments

scale

Laplacian noise scale.

alpha

Statistical significance, level-alpha, or (1. - alpha)100% confidence. Must be within (0, 1].

.T

Data type of scale and alpha


Construct an instance of the LInfDistance metric.

Description

linf_distance in Rust documentation.

Usage

linf_distance(.T, monotonic = FALSE)

Arguments

.T

The type of the distance.

monotonic

set to true if non-monotonicity implies infinite distance

Value

Metric


adaptive composition constructor

Description

Construct a Measurement that when invoked, returns a queryable that interactively composes measurements.

Usage

make_adaptive_composition(
  input_domain,
  input_metric,
  output_measure,
  d_in,
  d_mids
)

Arguments

input_domain

indicates the space of valid input datasets

input_metric

how distances are measured between members of the input domain

output_measure

how privacy is measured

d_in

maximum distance between adjacent input datasets

d_mids

maximum privacy expenditure of each query

Details

Required features: contrib

make_adaptive_composition in Rust documentation.

Citations:

Composition Properties

  • sequential: all measurements are applied to the same dataset

  • basic: the composition is the linear sum of the privacy usage of each query

  • interactive: mechanisms can be specified based on answers to previous queries

  • compositor: all privacy parameters specified up-front

If the privacy measure supports concurrency, this compositor allows you to spawn multiple interactive mechanisms and interleave your queries amongst them.

Supporting Elements:

  • Input Domain: DI

  • Output Type: MI

  • Input Metric: MO

  • Output Measure: ⁠Queryable<Measurement<DI, MI, MO, TO>, TO>⁠

Value

Measurement


alp queryable constructor

Description

Measurement to release a queryable containing a DP projection of bounded sparse data.

Usage

make_alp_queryable(
  input_domain,
  input_metric,
  scale,
  total_limit,
  value_limit = NULL,
  size_factor = 50L,
  alpha = 4L
)

Arguments

input_domain

Domain of input data

input_metric

Metric on input domain

scale

Privacy loss parameter. This is equal to epsilon/sensitivity.

total_limit

Either the true value or an upper bound estimate of the sum of all values in the input.

value_limit

Upper bound on individual values (referred to as β). Entries above β are clamped.

size_factor

Optional multiplier (default of 50) for setting the size of the projection.

alpha

Optional parameter (default of 4) for scaling and determining p in randomized response step.

Details

The size of the projection is O(total * size_factor * scale / alpha). The evaluation time of post-processing is O(beta * scale / alpha).

size_factor is an optional multiplier (defaults to 50) for setting the size of the projection. There is a memory/utility trade-off. The value should be sufficiently large to limit hash collisions.

Required features: contrib

make_alp_queryable in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠MapDomain<AtomDomain<K>, AtomDomain<CI>>⁠

  • Output Type: ⁠L01InfDistance<AbsoluteDistance<CI>>⁠

  • Input Metric: MaxDivergence

  • Output Measure: ⁠Queryable<K, f64>⁠

Value

Measurement


approximate constructor

Description

Constructs a new output measurement where the output measure is δ-approximate, where δ=0.

Usage

make_approximate(measurement)

Arguments

measurement

a measurement with a privacy measure to be casted

Details

Required features: contrib

make_approximate in Rust documentation.

Value

Measurement


b ary tree constructor

Description

Expand a vector of counts into a b-ary tree of counts, where each branch is the sum of its b immediate children.

Usage

make_b_ary_tree(input_domain, input_metric, leaf_count, branching_factor)

Arguments

input_domain

Domain of input data

input_metric

Metric on input domain

leaf_count

The number of leaf nodes in the b-ary tree.

branching_factor

The number of children on each branch of the resulting tree. Larger branching factors result in shallower trees.

Details

Required features: contrib

make_b_ary_tree in Rust documentation.

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<TA>>⁠

  • Output Domain: M

  • Input Metric: ⁠VectorDomain<AtomDomain<TA>>⁠

  • Output Metric: M

Value

Transformation


basic composition constructor

Description

Construct the DP composition [measurement0, measurement1, ...]. Returns a Measurement that when invoked, computes ⁠[measurement0(x), measurement1(x), ...]⁠

Usage

make_basic_composition(measurements)

Arguments

measurements

A vector of Measurements to compose.

Details

All metrics and domains must be equivalent.

Composition Properties

  • sequential: all measurements are applied to the same dataset

  • basic: the composition is the linear sum of the privacy usage of each query

  • noninteractive: all mechanisms specified up-front (but each can be interactive)

  • compositor: all privacy parameters specified up-front (via the map)

Required features: contrib

Value

Measurement


bounded float checked sum constructor

Description

Make a Transformation that computes the sum of bounded data with known dataset size.

Usage

make_bounded_float_checked_sum(size_limit, bounds, .S = "Pairwise<.T>")

Arguments

size_limit

Upper bound on number of records to keep in the input data.

bounds

Tuple of lower and upper bounds for data in the input domain.

.S

Summation algorithm to use over some data type T (T is shorthand for S::Item)

Details

This uses a restricted-sensitivity proof that takes advantage of known dataset size for better utility. Use make_clamp to bound data and make_resize to establish dataset size.

S (summation algorithm) input type
⁠Sequential<S::Item>⁠ ⁠Vec<S::Item>⁠
⁠Pairwise<S::Item>⁠ ⁠Vec<S::Item>⁠

S::Item is the type of all of the following: each bound, each element in the input data, the output data, and the output sensitivity.

For example, to construct a transformation that pairwise-sums f32 half-precision floats, set S to ⁠Pairwise<f32>⁠.

Required features: contrib

make_bounded_float_checked_sum in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<S::Item>>⁠

  • Output Domain: SymmetricDistance

  • Input Metric: ⁠AtomDomain<S::Item>⁠

  • Output Metric: ⁠AbsoluteDistance<S::Item>⁠

Value

Transformation


bounded float ordered sum constructor

Description

Make a Transformation that computes the sum of bounded floats with known ordering.

Usage

make_bounded_float_ordered_sum(size_limit, bounds, .S = "Pairwise<.T>")

Arguments

size_limit

Upper bound on the number of records in input data. Used to bound sensitivity.

bounds

Tuple of lower and upper bounds for data in the input domain.

.S

Summation algorithm to use over some data type T (T is shorthand for S::Item)

Details

Only useful when make_bounded_float_checked_sum returns an error due to potential for overflow. You may need to use make_ordered_random to impose an ordering on the data. The utility loss from overestimating the size_limit is small.

S (summation algorithm) input type
⁠Sequential<S::Item>⁠ ⁠Vec<S::Item>⁠
⁠Pairwise<S::Item>⁠ ⁠Vec<S::Item>⁠

S::Item is the type of all of the following: each bound, each element in the input data, the output data, and the output sensitivity.

For example, to construct a transformation that pairwise-sums f32 half-precision floats, set S to ⁠Pairwise<f32>⁠.

Required features: contrib

make_bounded_float_ordered_sum in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<S::Item>>⁠

  • Output Domain: InsertDeleteDistance

  • Input Metric: ⁠AtomDomain<S::Item>⁠

  • Output Metric: ⁠AbsoluteDistance<S::Item>⁠

Value

Transformation


bounded int monotonic sum constructor

Description

Make a Transformation that computes the sum of bounded ints, where all values share the same sign.

Usage

make_bounded_int_monotonic_sum(bounds, .T = NULL)

Arguments

bounds

Tuple of lower and upper bounds for data in the input domain.

.T

Atomic Input Type and Output Type

Details

Required features: contrib

make_bounded_int_monotonic_sum in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<T>>⁠

  • Output Domain: SymmetricDistance

  • Input Metric: ⁠AtomDomain<T>⁠

  • Output Metric: ⁠AbsoluteDistance<T>⁠

Value

Transformation


bounded int ordered sum constructor

Description

Make a Transformation that computes the sum of bounded ints. You may need to use make_ordered_random to impose an ordering on the data.

Usage

make_bounded_int_ordered_sum(bounds, .T = NULL)

Arguments

bounds

Tuple of lower and upper bounds for data in the input domain.

.T

Atomic Input Type and Output Type

Details

Required features: contrib

make_bounded_int_ordered_sum in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<T>>⁠

  • Output Domain: InsertDeleteDistance

  • Input Metric: ⁠AtomDomain<T>⁠

  • Output Metric: ⁠AbsoluteDistance<T>⁠

Value

Transformation


bounded int split sum constructor

Description

Make a Transformation that computes the sum of bounded ints. Adds the saturating sum of the positives to the saturating sum of the negatives.

Usage

make_bounded_int_split_sum(bounds, .T = NULL)

Arguments

bounds

Tuple of lower and upper bounds for data in the input domain.

.T

Atomic Input Type and Output Type

Details

Required features: contrib

make_bounded_int_split_sum in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<T>>⁠

  • Output Domain: SymmetricDistance

  • Input Metric: ⁠AtomDomain<T>⁠

  • Output Metric: ⁠AbsoluteDistance<T>⁠

Value

Transformation


canonical noise constructor

Description

Make a Measurement that adds noise from a canonical noise distribution. The implementation is tailored towards approximate-DP, resulting in noise sampled from the Tulap distribution.

Usage

make_canonical_noise(input_domain, input_metric, d_in, d_out)

Arguments

input_domain

Domain of the input.

input_metric

Metric of the input.

d_in

Sensitivity

d_out

Privacy parameters (ε, δ)

Details

Required features: contrib

make_canonical_noise in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠AtomDomain<f64>⁠

  • Output Type: ⁠AbsoluteDistance<f64>⁠

  • Input Metric: ⁠Approximate<MaxDivergence>⁠

  • Output Measure: f64

Proof Definition:

(Proof Document)

Value

Measurement


cast constructor

Description

Make a Transformation that casts a vector of data from type TIA to type TOA. For each element, failure to parse results in None, else Some(out).

Usage

make_cast(input_domain, input_metric, .TOA)

Arguments

input_domain

Domain of input data

input_metric

Metric on input domain

.TOA

Atomic Output Type to cast into

Details

Can be chained with make_impute_constant or make_drop_null to handle nullity.

Required features: contrib

make_cast in Rust documentation.

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<TIA>>⁠

  • Output Domain: M

  • Input Metric: ⁠VectorDomain<OptionDomain<AtomDomain<TOA>>>⁠

  • Output Metric: M

Value

Transformation


cast default constructor

Description

Make a Transformation that casts a vector of data from type TIA to type TOA. Any element that fails to cast is filled with default.

Usage

make_cast_default(input_domain, input_metric, .TOA)

Arguments

input_domain

Domain of input data

input_metric

Metric on input domain

.TOA

Atomic Output Type to cast into

Details

TIA TIA::default()
float 0.
int 0
string ""
bool false

Required features: contrib

make_cast_default in Rust documentation.

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<TIA>>⁠

  • Output Domain: M

  • Input Metric: ⁠VectorDomain<AtomDomain<TOA>>⁠

  • Output Metric: M

Value

Transformation


cast inherent constructor

Description

Make a Transformation that casts a vector of data from type TIA to a type that can represent nullity TOA. If cast fails, fill with TOA's null value.

Usage

make_cast_inherent(input_domain, input_metric, .TOA)

Arguments

input_domain

Domain of input data

input_metric

Metric on input domain

.TOA

Atomic Output Type to cast into

Details

TIA TIA::default()
float NaN

Required features: contrib

make_cast_inherent in Rust documentation.

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<TIA>>⁠

  • Output Domain: M

  • Input Metric: ⁠VectorDomain<AtomDomain<TOA>>⁠

  • Output Metric: M

Value

Transformation


cdf constructor

Description

Postprocess a noisy array of float summary counts into a cumulative distribution.

Usage

make_cdf(.TA = "float")

Arguments

.TA

Atomic Type. One of f32 or f64

Details

Required features: contrib

make_cdf in Rust documentation.

Supporting Elements:

  • Input Type: ⁠Vec<TA>⁠

  • Output Type: ⁠Vec<TA>⁠

Value

Function


chain mt constructor

Description

Construct the functional composition (measurement1transformation0). Returns a Measurement that when invoked, computes measurement1(transformation0(x)).

Usage

make_chain_mt(measurement1, transformation0)

Arguments

measurement1

outer mechanism

transformation0

inner transformation

Details

Required features: contrib

make_chain_mt in Rust documentation.

Value

Measurement


chain pm constructor

Description

Construct the functional composition (postprocess1measurement0). Returns a Measurement that when invoked, computes postprocess1(measurement0(x)). Used to represent non-interactive postprocessing.

Usage

make_chain_pm(postprocess1, measurement0)

Arguments

postprocess1

outer postprocessor

measurement0

inner measurement/mechanism

Details

Required features: contrib

make_chain_pm in Rust documentation.

Value

Measurement


chain tt constructor

Description

Construct the functional composition (transformation1transformation0). Returns a Transformation that when invoked, computes transformation1(transformation0(x)).

Usage

make_chain_tt(transformation1, transformation0)

Arguments

transformation1

outer transformation

transformation0

inner transformation

Details

Required features: contrib

make_chain_tt in Rust documentation.

Value

Transformation


clamp constructor

Description

Make a Transformation that clamps numeric data in ⁠Vec<TA>⁠ to bounds.

Usage

make_clamp(input_domain, input_metric, bounds)

Arguments

input_domain

Domain of input data.

input_metric

Metric on input domain.

bounds

Tuple of inclusive lower and upper bounds.

Details

If datum is less than lower, let datum be lower. If datum is greater than upper, let datum be upper.

Required features: contrib

make_clamp in Rust documentation.

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<TA>>⁠

  • Output Domain: M

  • Input Metric: ⁠VectorDomain<AtomDomain<TA>>⁠

  • Output Metric: M

Proof Definition:

(Proof Document)

Value

Transformation


composition constructor

Description

Construct the DP composition [measurement0, measurement1, ...]. Returns a Measurement that when invoked, computes ⁠[measurement0(x), measurement1(x), ...]⁠

Usage

make_composition(measurements)

Arguments

measurements

A vector of Measurements to compose.

Details

All metrics and domains must be equivalent.

Composition Properties

  • sequential: all measurements are applied to the same dataset

  • basic: the composition is the linear sum of the privacy usage of each query

  • noninteractive: all mechanisms specified up-front (but each can be interactive)

  • compositor: all privacy parameters specified up-front (via the map)

Required features: contrib

Value

Measurement


consistent b ary tree constructor

Description

Postprocessor that makes a noisy b-ary tree internally consistent, and returns the leaf layer.

Usage

make_consistent_b_ary_tree(branching_factor, .TIA = "int", .TOA = "float")

Arguments

branching_factor

the maximum number of children

.TIA

Atomic type of the input data. Should be an integer type.

.TOA

Atomic type of the output data. Should be a float type.

Details

The input argument of the function is a balanced b-ary tree implicitly stored in breadth-first order Tree is assumed to be complete, as in, all leaves on the last layer are on the left. Non-existent leaves are assumed to be zero.

The output remains consistent even when leaf nodes are missing. This is due to an adjustment to the original algorithm to apportion corrections to children relative to their variance.

Required features: contrib

make_consistent_b_ary_tree in Rust documentation.

Citations:

Supporting Elements:

  • Input Type: ⁠Vec<TIA>⁠

  • Output Type: ⁠Vec<TOA>⁠

Value

Function


count constructor

Description

Make a Transformation that computes a count of the number of records in data.

Usage

make_count(input_domain, input_metric, .TO = "int")

Arguments

input_domain

Domain of the data type to be released.

input_metric

Metric of the data type to be released.

.TO

Output Type. Must be numeric.

Details

Required features: contrib

make_count in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<TIA>>⁠

  • Output Domain: SymmetricDistance

  • Input Metric: ⁠AtomDomain<TO>⁠

  • Output Metric: ⁠AbsoluteDistance<TO>⁠

Proof Definition:

(Proof Document)

Value

Transformation


count by constructor

Description

Make a Transformation that computes the count of each unique value in data. This assumes that the category set is unknown.

Usage

make_count_by(input_domain, input_metric, .TV = "int")

Arguments

input_domain

Domain of input data

input_metric

Metric on input domain

.TV

Type of Value. Express counts in terms of this integral type.

Details

Required features: contrib

make_count_by in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<TK>>⁠

  • Output Domain: SymmetricDistance

  • Input Metric: ⁠MapDomain<AtomDomain<TK>, AtomDomain<TV>>⁠

  • Output Metric: ⁠L01InfDistance<AbsoluteDistance<TV>>⁠

Value

The carrier type is ⁠HashMap<TK, TV>⁠, a hashmap of the count (TV) for each unique data input (TK).


count by categories constructor

Description

Make a Transformation that computes the number of times each category appears in the data. This assumes that the category set is known.

Usage

make_count_by_categories(
  input_domain,
  input_metric,
  categories,
  null_category = TRUE,
  .MO = "L1Distance<int>",
  .TOA = "int"
)

Arguments

input_domain

Domain of input data

input_metric

Metric on input domain

categories

The set of categories to compute counts for.

null_category

Include a count of the number of elements that were not in the category set at the end of the vector.

.MO

Output Metric.

.TOA

Atomic Output Type that is numeric.

Details

Required features: contrib

make_count_by_categories in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<TIA>>⁠

  • Output Domain: SymmetricDistance

  • Input Metric: ⁠VectorDomain<AtomDomain<TOA>>⁠

  • Output Metric: MO

Value

The carrier type is ⁠Vec<TOA>⁠, a vector of the counts (TOA).


count distinct constructor

Description

Make a Transformation that computes a count of the number of unique, distinct records in data.

Usage

make_count_distinct(input_domain, input_metric, .TO = "int")

Arguments

input_domain

Domain of input data

input_metric

Metric on input domain

.TO

Output Type. Must be numeric.

Details

Required features: contrib

make_count_distinct in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<TIA>>⁠

  • Output Domain: SymmetricDistance

  • Input Metric: ⁠AtomDomain<TO>⁠

  • Output Metric: ⁠AbsoluteDistance<TO>⁠

Value

Transformation


create dataframe constructor

Description

Make a Transformation that constructs a dataframe from a ⁠Vec<Vec<String>>⁠ (a vector of records).

Usage

make_create_dataframe(col_names, .K = NULL)

Arguments

col_names

Column names for each record entry.

.K

categorical/hashable data type of column names

Details

Required features: contrib

make_create_dataframe in Rust documentation.

Supporting Elements:

  • Input Domain: ⁠VectorDomain<VectorDomain<AtomDomain<String>>>⁠

  • Output Domain: SymmetricDistance

  • Input Metric: ⁠DataFrameDomain<K>⁠

  • Output Metric: SymmetricDistance

Value

Transformation


df cast default constructor

Description

Make a Transformation that casts the elements in a column in a dataframe from type TIA to type TOA. If cast fails, fill with default.

Usage

make_df_cast_default(input_domain, input_metric, column_name, .TIA, .TOA)

Arguments

input_domain

Domain of input data

input_metric

Metric on input domain

column_name

column name to be transformed

.TIA

Atomic Input Type to cast from

.TOA

Atomic Output Type to cast into

Details

TIA TIA::default()
float 0.
int 0
string ""
bool false

Required features: contrib

make_df_cast_default in Rust documentation.

Supporting Elements:

  • Input Domain: ⁠DataFrameDomain<TK>⁠

  • Output Domain: M

  • Input Metric: ⁠DataFrameDomain<TK>⁠

  • Output Metric: M

Value

Transformation


df is equal constructor

Description

Make a Transformation that checks if each element in a column in a dataframe is equivalent to value.

Usage

make_df_is_equal(input_domain, input_metric, column_name, value, .TIA = NULL)

Arguments

input_domain

Domain of input data

input_metric

Metric on input domain

column_name

Column name to be transformed

value

Value to check for equality

.TIA

Atomic Input Type to cast from

Details

Required features: contrib

make_df_is_equal in Rust documentation.

Supporting Elements:

  • Input Domain: ⁠DataFrameDomain<TK>⁠

  • Output Domain: M

  • Input Metric: ⁠DataFrameDomain<TK>⁠

  • Output Metric: M

Value

Transformation


drop null constructor

Description

Make a Transformation that drops null values.

Usage

make_drop_null(input_domain, input_metric)

Arguments

input_domain

Domain of input data

input_metric

Metric on input domain

Details

input_domain
vector_domain(option_domain(atom_domain(TA)))
vector_domain(atom_domain(TA))

Required features: contrib

make_drop_null in Rust documentation.

Supporting Elements:

  • Input Domain: ⁠VectorDomain<DIA>⁠

  • Output Domain: M

  • Input Metric: ⁠VectorDomain<AtomDomain<DIA::Imputed>>⁠

  • Output Metric: M

Value

Transformation


find constructor

Description

Find the index of a data value in a set of categories.

Usage

make_find(input_domain, input_metric, categories)

Arguments

input_domain

The domain of the input vector.

input_metric

The metric of the input vector.

categories

The set of categories to find indexes from.

Details

For each value in the input vector, finds the index of the value in categories. If an index is found, returns Some(index), else None. Chain with make_impute_constant or make_drop_null to handle nullity.

Required features: contrib

make_find in Rust documentation.

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<TIA>>⁠

  • Output Domain: M

  • Input Metric: ⁠VectorDomain<OptionDomain<AtomDomain<usize>>>⁠

  • Output Metric: M

Value

Transformation


find bin constructor

Description

Make a transformation that finds the bin index in a monotonically increasing vector of edges.

Usage

make_find_bin(input_domain, input_metric, edges)

Arguments

input_domain

The domain of the input vector.

input_metric

The metric of the input vector.

edges

The set of edges to split bins by.

Details

For each value in the input vector, finds the index of the bin the value falls into. edges splits the entire range of TIA into bins. The first bin at index zero ranges from negative infinity to the first edge, non-inclusive. The last bin at index edges.len() ranges from the last bin, inclusive, to positive infinity.

To be valid, edges must be unique and ordered. edges are left inclusive, right exclusive.

Required features: contrib

make_find_bin in Rust documentation.

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<TIA>>⁠

  • Output Domain: M

  • Input Metric: ⁠VectorDomain<AtomDomain<usize>>⁠

  • Output Metric: M

Value

Transformation


fix delta constructor

Description

Fix the delta parameter in the privacy map of a measurement with a SmoothedMaxDivergence output measure.

Usage

make_fix_delta(measurement, delta)

Arguments

measurement

a measurement with a privacy curve to be fixed

delta

parameter to fix the privacy curve with

Details

Required features: contrib

make_fix_delta in Rust documentation.

Value

Measurement


fixed approxDP to approxDP constructor

Description

Constructs a new output measurement where the output measure is casted from ⁠Approximate<MaxDivergence>⁠ to SmoothedMaxDivergence.

Usage

make_fixed_approxDP_to_approxDP(measurement)

Arguments

measurement

a measurement with a privacy measure to be casted

Details

Required features: contrib

make_fixed_approxDP_to_approxDP in Rust documentation.

Value

Measurement


fully adaptive composition constructor

Description

Construct an odometer that can spawn a compositor queryable.

Usage

make_fully_adaptive_composition(input_domain, input_metric, output_measure)

Arguments

input_domain

indicates the space of valid input datasets

input_metric

how distances are measured between members of the input domain

output_measure

how privacy is measured

Details

Required features: contrib

make_fully_adaptive_composition in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain DI

  • Input Metric MI

  • Output Measure MO

  • Query ⁠Measurement<DI, MI, MO, TO>⁠

  • Answer TO

Proof Definition:

(Proof Document)

Value

Odometer


gaussian constructor

Description

Make a Measurement that adds noise from the Gaussian(scale) distribution to the input.

Usage

make_gaussian(
  input_domain,
  input_metric,
  scale,
  k = NULL,
  .MO = "ZeroConcentratedDivergence"
)

Arguments

input_domain

Domain of the data type to be released.

input_metric

Metric of the data type to be released.

scale

Noise scale parameter for the gaussian distribution. scale == standard_deviation.

k

The noise granularity in terms of 2^k.

.MO

Output Measure. The only valid measure is ZeroConcentratedDivergence.

Details

Valid inputs for input_domain and input_metric are:

input_domain input type input_metric
atom_domain(T) T absolute_distance(QI)
vector_domain(atom_domain(T)) ⁠Vec<T>⁠ l2_distance(QI)

Required features: contrib

make_gaussian in Rust documentation.

Supporting Elements:

  • Input Domain: DI

  • Output Type: MI

  • Input Metric: MO

  • Output Measure: DI::Carrier

Proof Definition:

(Proof Document)

Value

Measurement

Examples

library(opendp)
enable_features("contrib")
gaussian <- make_gaussian(
  atom_domain(.T = f64, nan = FALSE),
  absolute_distance(.T = f64),
  scale = 1.0)
gaussian(arg = 100.0)

# Or, more readably, define the space and then chain:
space <- c(atom_domain(.T = f64, nan = FALSE), absolute_distance(.T = f64))
gaussian <- space |> then_gaussian(scale = 1.0)
gaussian(arg = 100.0)

# Sensitivity of this measurement:
gaussian(d_in = 1)
gaussian(d_in = 2)
gaussian(d_in = 4)

# Typically will be used with vectors rather than individual numbers:
space <- c(vector_domain(atom_domain(.T = i32)), l2_distance(.T = i32))
gaussian <- space |> then_gaussian(scale = 1.0)
gaussian(arg = c(10L, 20L, 30L))

gaussian threshold constructor

Description

Make a Measurement that uses propose-test-release to release a hashmap of counts.

Usage

make_gaussian_threshold(
  input_domain,
  input_metric,
  scale,
  threshold,
  k = NULL,
  .MO = "Approximate<ZeroConcentratedDivergence>"
)

Arguments

input_domain

Domain of the input.

input_metric

Metric for the input domain.

scale

Noise scale parameter for the laplace distribution. scale == standard_deviation / sqrt(2).

threshold

Exclude pairs with values whose distance from zero exceeds this value.

k

The noise granularity in terms of 2^k.

.MO

Output Measure.

Details

This function takes a noise granularity in terms of 2^k. Larger granularities are more computationally efficient, but have a looser privacy map. If k is not set, k defaults to the smallest granularity.

Required features: contrib

make_gaussian_threshold in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: DI

  • Output Type: MI

  • Input Metric: MO

  • Output Measure: DI::Carrier

Proof Definition:

(Proof Document)

Value

Measurement


geometric constructor

Description

Equivalent to make_laplace but restricted to an integer support. Can specify bounds to run the algorithm in near constant-time.

Usage

make_geometric(
  input_domain,
  input_metric,
  scale,
  bounds = NULL,
  .MO = "MaxDivergence"
)

Arguments

input_domain

Domain of the data type to be released.

input_metric

Metric of the data type to be released.

scale

Noise scale parameter for the distribution. scale == standard_deviation / sqrt(2).

bounds

Set bounds on the count to make the algorithm run in constant-time.

.MO

Measure used to quantify privacy loss. Valid values are just MaxDivergence

Details

Required features: contrib

make_geometric in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: DI

  • Output Type: MI

  • Input Metric: MO

  • Output Measure: DI::Carrier

Proof Definition:

(Proof Document)

Value

Measurement


identity constructor

Description

Make a Transformation representing the identity function.

Usage

make_identity(domain, metric)

Arguments

domain

Domain of input data

metric

Metric on input domain

Details

WARNING: In Python, this function does not ensure that the domain and metric form a valid metric space. However, if the domain and metric do not form a valid metric space, then the resulting Transformation won't be chainable with any valid Transformation, so it cannot be used to introduce an invalid metric space into a chain of valid Transformations.

Required features: contrib, honest-but-curious

make_identity in Rust documentation.

Why honest-but-curious?:

For the result to be a valid transformation, the input_domain and input_metric pairing must form a valid metric space. For instance, the symmetric distance metric and atom domain do not form a valid metric space, because the metric cannot be used to measure distances between any two elements of an atom domain. Whereas, the symmetric distance metric and vector domain, or absolute distance metric and atom domain on a scalar type, both form valid metric spaces.

Supporting Elements:

  • Input Domain: D

  • Output Domain: M

  • Input Metric: D

  • Output Metric: M

Value

Transformation


impute constant constructor

Description

Make a Transformation that replaces null/None data with constant.

Usage

make_impute_constant(input_domain, input_metric, constant)

Arguments

input_domain

Domain of the input data. See table above.

input_metric

Metric of the input data. A dataset metric.

constant

Value to replace nulls with.

Details

If chaining after a make_cast, the input type is ⁠Option<Vec<TA>>⁠. If chaining after a make_cast_inherent, the input type is ⁠Vec<TA>⁠, where TA may take on float NaNs.

input_domain Input Data Type
vector_domain(option_domain(atom_domain(TA))) ⁠Vec<Option<TA>>⁠
vector_domain(atom_domain(TA)) ⁠Vec<TA>⁠

Required features: contrib

make_impute_constant in Rust documentation.

Supporting Elements:

  • Input Domain: ⁠VectorDomain<DIA>⁠

  • Output Domain: M

  • Input Metric: ⁠VectorDomain<AtomDomain<DIA::Imputed>>⁠

  • Output Metric: M

Value

Transformation


impute uniform float constructor

Description

Make a Transformation that replaces NaN values in ⁠Vec<TA>⁠ with uniformly distributed floats within bounds.

Usage

make_impute_uniform_float(input_domain, input_metric, bounds)

Arguments

input_domain

Domain of the input.

input_metric

Metric of the input.

bounds

Tuple of inclusive lower and upper bounds.

Details

Required features: contrib

make_impute_uniform_float in Rust documentation.

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<TA>>⁠

  • Output Domain: M

  • Input Metric: ⁠VectorDomain<AtomDomain<TA>>⁠

  • Output Metric: M

Value

Transformation


index constructor

Description

Make a transformation that treats each element as an index into a vector of categories.

Usage

make_index(input_domain, input_metric, categories, null, .TOA = NULL)

Arguments

input_domain

The domain of the input vector.

input_metric

The metric of the input vector.

categories

The set of categories to index into.

null

Category to return if the index is out-of-range of the category set.

.TOA

Atomic Output Type. Output data will be ⁠Vec<TOA>⁠.

Details

Required features: contrib

make_index in Rust documentation.

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<usize>>⁠

  • Output Domain: M

  • Input Metric: ⁠VectorDomain<AtomDomain<TOA>>⁠

  • Output Metric: M

Value

Transformation


is equal constructor

Description

Make a Transformation that checks if each element is equal to value.

Usage

make_is_equal(input_domain, input_metric, value)

Arguments

input_domain

Domain of input data

input_metric

Metric on input domain

value

value to check against

Details

Required features: contrib

make_is_equal in Rust documentation.

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<TIA>>⁠

  • Output Domain: M

  • Input Metric: ⁠VectorDomain<AtomDomain<bool>>⁠

  • Output Metric: M

Proof Definition:

(Proof Document)

Value

Transformation


is null constructor

Description

Make a Transformation that checks if each element in a vector is null or nan.

Usage

make_is_null(input_domain, input_metric)

Arguments

input_domain

Domain of input data

input_metric

Metric on input domain

Details

Required features: contrib

make_is_null in Rust documentation.

Supporting Elements:

  • Input Domain: ⁠VectorDomain<DIA>⁠

  • Output Domain: M

  • Input Metric: ⁠VectorDomain<AtomDomain<bool>>⁠

  • Output Metric: M

Value

Transformation


laplace constructor

Description

Make a Measurement that adds noise from the Laplace(scale) distribution to the input.

Usage

make_laplace(
  input_domain,
  input_metric,
  scale,
  k = NULL,
  .MO = "MaxDivergence"
)

Arguments

input_domain

Domain of the data type to be released.

input_metric

Metric of the data type to be released.

scale

Noise scale parameter for the Laplace distribution. scale == standard_deviation / sqrt(2).

k

The noise granularity in terms of 2^k, only valid for domains over floats.

.MO

Measure used to quantify privacy loss. Valid values are just MaxDivergence

Details

Valid inputs for input_domain and input_metric are:

input_domain input type input_metric
atom_domain(T) (default) T absolute_distance(T)
vector_domain(atom_domain(T)) ⁠Vec<T>⁠ l1_distance(T)

Internally, all sampling is done using the discrete Laplace distribution.

Required features: contrib

make_laplace in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: DI

  • Output Type: MI

  • Input Metric: MO

  • Output Measure: DI::Carrier

Proof Definition:

(Proof Document)

Value

Measurement


laplace threshold constructor

Description

Make a Measurement that uses propose-test-release to release a hashmap of counts.

Usage

make_laplace_threshold(
  input_domain,
  input_metric,
  scale,
  threshold,
  k = NULL,
  .MO = "Approximate<MaxDivergence>"
)

Arguments

input_domain

Domain of the input.

input_metric

Metric for the input domain.

scale

Noise scale parameter for the laplace distribution. scale == standard_deviation / sqrt(2).

threshold

Exclude counts that are less than this minimum value.

k

The noise granularity in terms of 2^k.

.MO

Output Measure.

Details

This function takes a noise granularity in terms of 2^k. Larger granularities are more computationally efficient, but have a looser privacy map. If k is not set, k defaults to the smallest granularity.

Required features: contrib

make_laplace_threshold in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: DI

  • Output Type: MI

  • Input Metric: MO

  • Output Measure: DI::Carrier

Proof Definition:

(Proof Document)

Value

Measurement


lipschitz float mul constructor

Description

Make a transformation that multiplies an aggregate by a constant.

Usage

make_lipschitz_float_mul(input_domain, input_metric, constant, bounds)

Arguments

input_domain

The domain of the input.

input_metric

The metric of the input.

constant

The constant to multiply aggregates by.

bounds

Tuple of inclusive lower and upper bounds.

Details

The bounds clamp the input, in order to bound the increase in sensitivity from float rounding.

Required features: contrib

make_lipschitz_float_mul in Rust documentation.

Supporting Elements:

  • Input Domain: ⁠AtomDomain<TA>⁠

  • Output Domain: ⁠AbsoluteDistance<TA>⁠

  • Input Metric: ⁠AtomDomain<TA>⁠

  • Output Metric: ⁠AbsoluteDistance<TA>⁠

Value

Transformation


mean constructor

Description

Make a Transformation that computes the mean of bounded data.

Usage

make_mean(input_domain, input_metric)

Arguments

input_domain

Domain of input data

input_metric

Metric on input domain

Details

This uses a restricted-sensitivity proof that takes advantage of known dataset size. Use make_clamp to bound data and make_resize to establish dataset size.

Required features: contrib

make_mean in Rust documentation.

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<T>>⁠

  • Output Domain: MI

  • Input Metric: ⁠AtomDomain<T>⁠

  • Output Metric: ⁠AbsoluteDistance<T>⁠

Value

Transformation


metric bounded constructor

Description

Make a Transformation that converts the unbounded dataset metric MI to the respective bounded dataset metric with a no-op.

Usage

make_metric_bounded(input_domain, input_metric)

Arguments

input_domain

Domain of input data

input_metric

Metric on input domain

Details

The constructor enforces that the input domain has known size, because it must have known size to be valid under a bounded dataset metric.

MI MI::BoundedMetric
SymmetricDistance ChangeOneDistance
InsertDeleteDistance HammingDistance

Required features: contrib

make_metric_bounded in Rust documentation.

Supporting Elements:

  • Input Domain: D

  • Output Domain: MI

  • Input Metric: D

  • Output Metric: MI::BoundedMetric

Value

Transformation


metric unbounded constructor

Description

Make a Transformation that converts the bounded dataset metric MI to the respective unbounded dataset metric with a no-op.

Usage

make_metric_unbounded(input_domain, input_metric)

Arguments

input_domain

Domain of input data

input_metric

Metric on input domain

Details

MI MI::UnboundedMetric
ChangeOneDistance SymmetricDistance
HammingDistance InsertDeleteDistance

Required features: contrib

make_metric_unbounded in Rust documentation.

Supporting Elements:

  • Input Domain: D

  • Output Domain: MI

  • Input Metric: D

  • Output Metric: MI::UnboundedMetric

Value

Transformation


noise constructor

Description

Make a Measurement that adds noise from the appropriate distribution to the input.

Usage

make_noise(input_domain, input_metric, output_measure, scale, k = NULL)

Arguments

input_domain

Domain of the data type to be released.

input_metric

Metric of the data type to be released.

output_measure

Privacy measure. Either MaxDivergence or ZeroConcentratedDivergence.

scale

Noise scale parameter.

k

The noise granularity in terms of 2^k.

Details

Valid inputs for input_domain and input_metric are:

input_domain input type input_metric
atom_domain(T) T absolute_distance(QI)
vector_domain(atom_domain(T)) ⁠Vec<T>⁠ l2_distance(QI)

Required features: contrib

make_noise in Rust documentation.

Supporting Elements:

  • Input Domain: DI

  • Output Type: MI

  • Input Metric: MO

  • Output Measure: DI::Carrier

Value

Measurement


noise threshold constructor

Description

Make a Measurement that uses propose-test-release to release a hashmap of counts.

Usage

make_noise_threshold(
  input_domain,
  input_metric,
  output_measure,
  scale,
  threshold,
  k = NULL
)

Arguments

input_domain

Domain of the input.

input_metric

Metric for the input domain.

output_measure

Privacy measure. Either MaxDivergence or ZeroConcentratedDivergence.

scale

Noise scale parameter for the laplace distribution. scale == standard_deviation / sqrt(2).

threshold

Exclude counts that are less than this minimum value.

k

The noise granularity in terms of 2^k.

Details

This function takes a noise granularity in terms of 2^k. Larger granularities are more computationally efficient, but have a looser privacy map. If k is not set, k defaults to the smallest granularity.

Required features: contrib

make_noise_threshold in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: DI

  • Output Type: MI

  • Input Metric: ⁠Approximate<MO>⁠

  • Output Measure: DI::Carrier

Value

Measurement


noisy max constructor

Description

Make a Measurement that takes a vector of scores and privately selects the index of the highest score.

Usage

make_noisy_max(
  input_domain,
  input_metric,
  output_measure,
  scale,
  negate = FALSE
)

Arguments

input_domain

Domain of the input vector. Must be a non-nullable VectorDomain

input_metric

Metric on the input domain. Must be LInfDistance

output_measure

One of MaxDivergence, ZeroConcentratedDivergence

scale

Scale for the noise distribution

negate

Set to true to return min

Details

Required features: contrib

make_noisy_max in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<TIA>>⁠

  • Output Type: ⁠LInfDistance<TIA>⁠

  • Input Metric: MO

  • Output Measure: usize

Value

Measurement


noisy top k constructor

Description

Make a Measurement that takes a vector of scores and privately selects the index of the highest score.

Usage

make_noisy_top_k(
  input_domain,
  input_metric,
  output_measure,
  k,
  scale,
  negate = FALSE
)

Arguments

input_domain

Domain of the input vector. Must be a non-nullable VectorDomain.

input_metric

Metric on the input domain. Must be LInfDistance

output_measure

One of MaxDivergence or ZeroConcentratedDivergence

k

Number of indices to select.

scale

Scale for the noise distribution.

negate

Set to true to return bottom k

Details

Required features: contrib

make_noisy_top_k in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<TIA>>⁠

  • Output Type: ⁠LInfDistance<TIA>⁠

  • Input Metric: MO

  • Output Measure: ⁠Vec<usize>⁠

Proof Definition:

(Proof Document)

Value

Measurement


ordered random constructor

Description

Make a Transformation that converts the unordered dataset metric SymmetricDistance to the respective ordered dataset metric InsertDeleteDistance by assigning a random permutation.

Usage

make_ordered_random(input_domain, input_metric)

Arguments

input_domain

Domain of input data

input_metric

Metric on input domain

Details

MI MI::OrderedMetric
SymmetricDistance InsertDeleteDistance
ChangeOneDistance HammingDistance

Required features: contrib

make_ordered_random in Rust documentation.

Supporting Elements:

  • Input Domain: D

  • Output Domain: MI

  • Input Metric: D

  • Output Metric: MI::OrderedMetric

Value

Transformation


population amplification constructor

Description

Construct an amplified measurement from a measurement with privacy amplification by subsampling. This measurement does not perform any sampling. It is useful when you have a dataset on-hand that is a simple random sample from a larger population.

Usage

make_population_amplification(measurement, population_size)

Arguments

measurement

the computation to amplify

population_size

the size of the population from which the input dataset is a simple sample

Details

The DIA, DO, MI and MO between the input measurement and amplified output measurement all match.

Required features: contrib, honest-but-curious

make_population_amplification in Rust documentation.

Why honest-but-curious?:

The privacy guarantees are only valid if the input dataset is a simple sample from a population with population_size records.

Value

Measurement


privacy filter constructor

Description

Combinator that limits the privacy loss of an odometer.

Usage

make_privacy_filter(odometer, d_in, d_out)

Arguments

odometer

A privacy odometer

d_in

Upper bound on the distance between adjacent datasets

d_out

Upper bound on the privacy loss

Details

Adjusts the queryable returned by the odometer to reject any query that would increase the total privacy loss above the privacy guarantee of the mechanism.

Required features: contrib

make_privacy_filter in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: DI

  • Output Type: MI

  • Input Metric: MO

  • Output Measure: ⁠OdometerQueryable<Q, A, MI::Distance, MO::Distance>⁠

Proof Definition:

(Proof Document)

Value

Measurement


private quantile constructor

Description

Make a Measurement that computes the quantile of a dataset.

Usage

make_private_quantile(
  input_domain,
  input_metric,
  output_measure,
  candidates,
  alpha,
  scale
)

Arguments

input_domain

Uses a tighter sensitivity when the size of vectors in the input domain is known.

input_metric

Either SymmetricDistance or InsertDeleteDistance.

output_measure

Either MaxDivergence or ZeroConcentratedDivergence.

candidates

Potential quantiles to score

alpha

a value in [0,1][0, 1]. Choose 0.5 for median

scale

the scale of the noise added

Details

Required features: contrib

make_private_quantile in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<T>>⁠

  • Output Type: MI

  • Input Metric: MO

  • Output Measure: T

Value

Measurement


pureDP to zCDP constructor

Description

Constructs a new output measurement where the output measure is casted from MaxDivergence to ZeroConcentratedDivergence.

Usage

make_pureDP_to_zCDP(measurement)

Arguments

measurement

a measurement with a privacy measure to be casted

Details

Required features: contrib

make_pureDP_to_zCDP in Rust documentation.

Citations:

Value

Measurement


quantile score candidates constructor

Description

Makes a Transformation that scores how similar each candidate is to the given alpha-quantile on the input dataset.

Usage

make_quantile_score_candidates(input_domain, input_metric, candidates, alpha)

Arguments

input_domain

Uses a smaller sensitivity when the size of vectors in the input domain is known.

input_metric

Either SymmetricDistance or InsertDeleteDistance.

candidates

Potential quantiles to score

alpha

a value in [0,1][0, 1]. Choose 0.5 for median

Details

Required features: contrib

make_quantile_score_candidates in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<TIA>>⁠

  • Output Domain: MI

  • Input Metric: ⁠VectorDomain<AtomDomain<u64>>⁠

  • Output Metric: ⁠LInfDistance<u64>⁠

Proof Definition:

(Proof Document)

Value

Transformation


quantiles from counts constructor

Description

Postprocess a noisy array of summary counts into quantiles.

Usage

make_quantiles_from_counts(
  bin_edges,
  alphas,
  interpolation = "linear",
  .TA = NULL,
  .F = "float"
)

Arguments

bin_edges

The edges that the input data was binned into before counting.

alphas

Return all specified alpha-quantiles.

interpolation

Must be one of linear or nearest

.TA

Atomic Type of the bin edges and data.

.F

Float type of the alpha argument. One of f32 or f64

Details

Required features: contrib

make_quantiles_from_counts in Rust documentation.

Supporting Elements:

  • Input Type: ⁠Vec<TA>⁠

  • Output Type: ⁠Vec<TA>⁠

Value

Function


randomized response constructor

Description

Make a Measurement that implements randomized response on a categorical value.

Usage

make_randomized_response(categories, prob, .T = NULL)

Arguments

categories

Set of valid outcomes

prob

Probability of returning the correct answer. Must be in ⁠[1/num_categories, 1]⁠

.T

Data type of a category.

Details

Required features: contrib

make_randomized_response in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠AtomDomain<T>⁠

  • Output Type: DiscreteDistance

  • Input Metric: MaxDivergence

  • Output Measure: T

Proof Definition:

(Proof Document)

Value

Measurement


randomized response bitvec constructor

Description

Make a Measurement that implements randomized response on a bit vector.

Usage

make_randomized_response_bitvec(
  input_domain,
  input_metric,
  f,
  constant_time = FALSE
)

Arguments

input_domain

BitVectorDomain with max_weight

input_metric

DiscreteDistance

f

Per-bit flipping probability. Must be in (0,1](0, 1].

constant_time

Whether to run the Bernoulli samplers in constant time, this is likely to be extremely slow.

Details

This primitive can be useful for implementing RAPPOR.

Required features: contrib

make_randomized_response_bitvec in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: BitVectorDomain

  • Output Type: DiscreteDistance

  • Input Metric: MaxDivergence

  • Output Measure: BitVector

Proof Definition:

(Proof Document)

Value

Measurement


randomized response bool constructor

Description

Make a Measurement that implements randomized response on a boolean value.

Usage

make_randomized_response_bool(prob, constant_time = FALSE)

Arguments

prob

Probability of returning the correct answer. Must be in ⁠[0.5, 1]⁠

constant_time

Set to true to enable constant time. Slower.

Details

Required features: contrib

make_randomized_response_bool in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠AtomDomain<bool>⁠

  • Output Type: DiscreteDistance

  • Input Metric: MaxDivergence

  • Output Measure: bool

Proof Definition:

(Proof Document)

Value

Measurement


report noisy max gumbel constructor

Description

Make a Measurement that takes a vector of scores and privately selects the index of the highest score.

Usage

make_report_noisy_max_gumbel(
  input_domain,
  input_metric,
  scale,
  optimize = "max"
)

Arguments

input_domain

Domain of the input vector. Must be a non-nullable VectorDomain

input_metric

Metric on the input domain. Must be LInfDistance

scale

Scale for the noise distribution

optimize

Set to "min" to report noisy min

Details

Required features: contrib

make_report_noisy_max_gumbel in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<TIA>>⁠

  • Output Type: ⁠LInfDistance<TIA>⁠

  • Input Metric: MaxDivergence

  • Output Measure: usize

Value

Measurement


resize constructor

Description

Make a Transformation that either truncates or imputes records with constant to match a provided size.

Usage

make_resize(
  input_domain,
  input_metric,
  size,
  constant,
  .MO = "SymmetricDistance"
)

Arguments

input_domain

Domain of input data.

input_metric

Metric of input data.

size

Number of records in output data.

constant

Value to impute with.

.MO

Output Metric. One of InsertDeleteDistance or SymmetricDistance

Details

Required features: contrib

make_resize in Rust documentation.

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<TA>>⁠

  • Output Domain: MI

  • Input Metric: ⁠VectorDomain<AtomDomain<TA>>⁠

  • Output Metric: MO

Value

A vector of the same type TA, but with the provided size.


select column constructor

Description

Make a Transformation that retrieves the column key from a dataframe as ⁠Vec<TOA>⁠.

Usage

make_select_column(key, .TOA, .K = NULL)

Arguments

key

categorical/hashable data type of the key/column name

.TOA

Atomic Output Type to downcast vector to

.K

data type of key

Details

Required features: contrib

make_select_column in Rust documentation.

Supporting Elements:

  • Input Domain: ⁠DataFrameDomain<K>⁠

  • Output Domain: SymmetricDistance

  • Input Metric: ⁠VectorDomain<AtomDomain<TOA>>⁠

  • Output Metric: SymmetricDistance

Value

Transformation


select private candidate constructor

Description

Select a private candidate whose score is above a threshold.

Usage

make_select_private_candidate(measurement, stop_probability, threshold)

Arguments

measurement

A measurement that releases a 2-tuple of (score, candidate)

stop_probability

The probability of stopping early at any iteration.

threshold

The threshold score. Return immediately if the score is above this threshold.

Details

Given measurement that satisfies ε-DP, returns new measurement M' that satisfies 2ε-DP. M' releases the first invocation of measurement whose score is above threshold.

Each time a score is below threshold the algorithm may terminate with probability stop_probability and return nothing.

measurement should make releases in the form of (score, candidate). If you are writing a custom scorer measurement in Python, specify the output type as ⁠TO=(float, "ExtrinsicObject")⁠. This ensures that the float value is accessible to the algorithm. The candidate, left as arbitrary Python data, is held behind the ExtrinsicObject.

Algorithm 1 in Private selection from private candidates (Liu and Talwar, STOC 2019).

Required features: contrib

make_select_private_candidate in Rust documentation.

Supporting Elements:

  • Input Domain: DI

  • Output Type: MI

  • Input Metric: MaxDivergence

  • Output Measure: ⁠Option<(f64, TO)>⁠

Proof Definition:

(Proof Document)

Value

A measurement that returns a release from measurement whose score is greater than threshold, or none.


sequential composition constructor

Description

Construct a Measurement that when invoked, returns a queryable that interactively composes measurements.

Usage

make_sequential_composition(
  input_domain,
  input_metric,
  output_measure,
  d_in,
  d_mids
)

Arguments

input_domain

indicates the space of valid input datasets

input_metric

how distances are measured between members of the input domain

output_measure

how privacy is measured

d_in

maximum distance between adjacent input datasets

d_mids

maximum privacy expenditure of each query

Details

Required features: contrib

make_sequential_composition in Rust documentation.

Citations:

Composition Properties

  • sequential: all measurements are applied to the same dataset

  • basic: the composition is the linear sum of the privacy usage of each query

  • interactive: mechanisms can be specified based on answers to previous queries

  • compositor: all privacy parameters specified up-front

If the privacy measure supports concurrency, this compositor allows you to spawn multiple interactive mechanisms and interleave your queries amongst them.

Supporting Elements:

  • Input Domain: DI

  • Output Type: MI

  • Input Metric: MO

  • Output Measure: ⁠Queryable<Measurement<DI, MI, MO, TO>, TO>⁠

Value

Measurement


sized bounded float checked sum constructor

Description

Make a Transformation that computes the sum of bounded floats with known dataset size.

Usage

make_sized_bounded_float_checked_sum(size, bounds, .S = "Pairwise<.T>")

Arguments

size

Number of records in input data.

bounds

Tuple of lower and upper bounds for data in the input domain.

.S

Summation algorithm to use over some data type T (T is shorthand for S::Item)

Details

This uses a restricted-sensitivity proof that takes advantage of known dataset size for better utility.

S (summation algorithm) input type
⁠Sequential<S::Item>⁠ ⁠Vec<S::Item>⁠
⁠Pairwise<S::Item>⁠ ⁠Vec<S::Item>⁠

S::Item is the type of all of the following: each bound, each element in the input data, the output data, and the output sensitivity.

For example, to construct a transformation that pairwise-sums f32 half-precision floats, set S to ⁠Pairwise<f32>⁠.

Required features: contrib

make_sized_bounded_float_checked_sum in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<S::Item>>⁠

  • Output Domain: SymmetricDistance

  • Input Metric: ⁠AtomDomain<S::Item>⁠

  • Output Metric: ⁠AbsoluteDistance<S::Item>⁠

Value

Transformation


sized bounded float ordered sum constructor

Description

Make a Transformation that computes the sum of bounded floats with known ordering and dataset size.

Usage

make_sized_bounded_float_ordered_sum(size, bounds, .S = "Pairwise<.T>")

Arguments

size

Number of records in input data.

bounds

Tuple of lower and upper bounds for data in the input domain.

.S

Summation algorithm to use over some data type T (T is shorthand for S::Item)

Details

Only useful when make_bounded_float_checked_sum returns an error due to potential for overflow. This uses a restricted-sensitivity proof that takes advantage of known dataset size for better utility. You may need to use make_ordered_random to impose an ordering on the data.

S (summation algorithm) input type
⁠Sequential<S::Item>⁠ ⁠Vec<S::Item>⁠
⁠Pairwise<S::Item>⁠ ⁠Vec<S::Item>⁠

S::Item is the type of all of the following: each bound, each element in the input data, the output data, and the output sensitivity.

For example, to construct a transformation that pairwise-sums f32 half-precision floats, set S to ⁠Pairwise<f32>⁠.

Required features: contrib

make_sized_bounded_float_ordered_sum in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<S::Item>>⁠

  • Output Domain: InsertDeleteDistance

  • Input Metric: ⁠AtomDomain<S::Item>⁠

  • Output Metric: ⁠AbsoluteDistance<S::Item>⁠

Value

Transformation


sized bounded int checked sum constructor

Description

Make a Transformation that computes the sum of bounded ints. The effective range is reduced, as (bounds * size) must not overflow.

Usage

make_sized_bounded_int_checked_sum(size, bounds, .T = NULL)

Arguments

size

Number of records in input data.

bounds

Tuple of lower and upper bounds for data in the input domain.

.T

Atomic Input Type and Output Type

Details

Required features: contrib

make_sized_bounded_int_checked_sum in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<T>>⁠

  • Output Domain: SymmetricDistance

  • Input Metric: ⁠AtomDomain<T>⁠

  • Output Metric: ⁠AbsoluteDistance<T>⁠

Value

Transformation


sized bounded int monotonic sum constructor

Description

Make a Transformation that computes the sum of bounded ints, where all values share the same sign.

Usage

make_sized_bounded_int_monotonic_sum(size, bounds, .T = NULL)

Arguments

size

Number of records in input data.

bounds

Tuple of lower and upper bounds for data in the input domain.

.T

Atomic Input Type and Output Type

Details

Required features: contrib

make_sized_bounded_int_monotonic_sum in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<T>>⁠

  • Output Domain: SymmetricDistance

  • Input Metric: ⁠AtomDomain<T>⁠

  • Output Metric: ⁠AbsoluteDistance<T>⁠

Value

Transformation


sized bounded int ordered sum constructor

Description

Make a Transformation that computes the sum of bounded ints with known dataset size.

Usage

make_sized_bounded_int_ordered_sum(size, bounds, .T = NULL)

Arguments

size

Number of records in input data.

bounds

Tuple of lower and upper bounds for data in the input domain.

.T

Atomic Input Type and Output Type

Details

This uses a restricted-sensitivity proof that takes advantage of known dataset size for better utility. You may need to use make_ordered_random to impose an ordering on the data.

Required features: contrib

make_sized_bounded_int_ordered_sum in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<T>>⁠

  • Output Domain: InsertDeleteDistance

  • Input Metric: ⁠AtomDomain<T>⁠

  • Output Metric: ⁠AbsoluteDistance<T>⁠

Value

Transformation


sized bounded int split sum constructor

Description

Make a Transformation that computes the sum of bounded ints with known dataset size.

Usage

make_sized_bounded_int_split_sum(size, bounds, .T = NULL)

Arguments

size

Number of records in input data.

bounds

Tuple of lower and upper bounds for data in the input domain.

.T

Atomic Input Type and Output Type

Details

This uses a restricted-sensitivity proof that takes advantage of known dataset size for better utility. Adds the saturating sum of the positives to the saturating sum of the negatives.

Required features: contrib

make_sized_bounded_int_split_sum in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<T>>⁠

  • Output Domain: SymmetricDistance

  • Input Metric: ⁠AtomDomain<T>⁠

  • Output Metric: ⁠AbsoluteDistance<T>⁠

Value

Transformation


split dataframe constructor

Description

Make a Transformation that splits each record in a String into a ⁠Vec<Vec<String>>⁠, and loads the resulting table into a dataframe keyed by col_names.

Usage

make_split_dataframe(separator, col_names, .K = NULL)

Arguments

separator

The token(s) that separate entries in each record.

col_names

Column names for each record entry.

.K

categorical/hashable data type of column names

Details

Required features: contrib

make_split_dataframe in Rust documentation.

Supporting Elements:

  • Input Domain: ⁠AtomDomain<String>⁠

  • Output Domain: SymmetricDistance

  • Input Metric: ⁠DataFrameDomain<K>⁠

  • Output Metric: SymmetricDistance

Value

Transformation


split lines constructor

Description

Make a Transformation that takes a string and splits it into a ⁠Vec<String>⁠ of its lines.

Usage

make_split_lines()

Details

Required features: contrib

make_split_lines in Rust documentation.

Supporting Elements:

  • Input Domain: ⁠AtomDomain<String>⁠

  • Output Domain: SymmetricDistance

  • Input Metric: ⁠VectorDomain<AtomDomain<String>>⁠

  • Output Metric: SymmetricDistance

Value

Transformation


split records constructor

Description

Make a Transformation that splits each record in a ⁠Vec<String>⁠ into a ⁠Vec<Vec<String>>⁠.

Usage

make_split_records(separator)

Arguments

separator

The token(s) that separate entries in each record.

Details

Required features: contrib

make_split_records in Rust documentation.

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<String>>⁠

  • Output Domain: SymmetricDistance

  • Input Metric: ⁠VectorDomain<VectorDomain<AtomDomain<String>>>⁠

  • Output Metric: SymmetricDistance

Value

Transformation


subset by constructor

Description

Make a Transformation that subsets a dataframe by a boolean column.

Usage

make_subset_by(indicator_column, keep_columns, .TK = NULL)

Arguments

indicator_column

name of the boolean column that indicates inclusion in the subset

keep_columns

list of column names to apply subset to

.TK

Type of the column name

Details

Required features: contrib

make_subset_by in Rust documentation.

Supporting Elements:

  • Input Domain: ⁠DataFrameDomain<TK>⁠

  • Output Domain: SymmetricDistance

  • Input Metric: ⁠DataFrameDomain<TK>⁠

  • Output Metric: SymmetricDistance

Value

Transformation


sum constructor

Description

Make a Transformation that computes the sum of bounded data. Use make_clamp to bound data.

Usage

make_sum(input_domain, input_metric)

Arguments

input_domain

Domain of the input data.

input_metric

One of SymmetricDistance or InsertDeleteDistance.

Details

If dataset size is known, uses a restricted-sensitivity proof that takes advantage of known dataset size for better utility.

Required features: contrib

make_sum in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<T>>⁠

  • Output Domain: MI

  • Input Metric: ⁠AtomDomain<T>⁠

  • Output Metric: ⁠AbsoluteDistance<T>⁠

Value

Transformation


sum of squared deviations constructor

Description

Make a Transformation that computes the sum of squared deviations of bounded data.

Usage

make_sum_of_squared_deviations(input_domain, input_metric, .S = "Pairwise<.T>")

Arguments

input_domain

Domain of input data

input_metric

Metric on input domain

.S

Summation algorithm to use on data type T. One of ⁠Sequential<T>⁠ or ⁠Pairwise<T>⁠.

Details

This uses a restricted-sensitivity proof that takes advantage of known dataset size. Use make_clamp to bound data and make_resize to establish dataset size.

S (summation algorithm) input type
⁠Sequential<S::Item>⁠ ⁠Vec<S::Item>⁠
⁠Pairwise<S::Item>⁠ ⁠Vec<S::Item>⁠

S::Item is the type of all of the following: each bound, each element in the input data, the output data, and the output sensitivity.

For example, to construct a transformation that computes the SSD of f32 half-precision floats, set S to ⁠Pairwise<f32>⁠.

Required features: contrib

make_sum_of_squared_deviations in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<S::Item>>⁠

  • Output Domain: SymmetricDistance

  • Input Metric: ⁠AtomDomain<S::Item>⁠

  • Output Metric: ⁠AbsoluteDistance<S::Item>⁠

Value

Transformation


unordered constructor

Description

Make a Transformation that converts the ordered dataset metric MI to the respective ordered dataset metric with a no-op.

Usage

make_unordered(input_domain, input_metric)

Arguments

input_domain

Domain of input data

input_metric

Metric on input domain

Details

MI MI::UnorderedMetric
InsertDeleteDistance SymmetricDistance
HammingDistance ChangeOneDistance

Required features: contrib

make_unordered in Rust documentation.

Supporting Elements:

  • Input Domain: D

  • Output Domain: MI

  • Input Metric: D

  • Output Metric: MI::UnorderedMetric

Value

Transformation


user measurement constructor

Description

Construct a Measurement from user-defined callbacks.

Usage

make_user_measurement(
  input_domain,
  input_metric,
  output_measure,
  function_,
  privacy_map,
  .TO = "ExtrinsicObject"
)

Arguments

input_domain

A domain describing the set of valid inputs for the function.

input_metric

The metric from which distances between adjacent inputs are measured.

output_measure

The measure from which distances between adjacent output distributions are measured.

function_

A function mapping data from input_domain to a release of type TO.

privacy_map

A function mapping distances from input_metric to output_measure.

.TO

The data type of outputs from the function.

Details

Required features: contrib, honest-but-curious

Why honest-but-curious?:

This constructor only returns a valid measurement if for every pair of elements x,xx, x' in input_domain, and for every pair ⁠(d_in, d_out)⁠, where d_in has the associated type for input_metric and d_out has the associated type for output_measure, if x,xx, x' are d_in-close under input_metric, privacy_map(d_in) does not raise an exception, and privacy_map(d_in) <= d_out, then ⁠function(x), function(x')⁠ are d_out-close under output_measure.

In addition, function must not have side-effects, and privacy_map must be a pure function.

Supporting Elements:

  • Input Domain: AnyDomain

  • Output Type: AnyMetric

  • Input Metric: AnyMeasure

  • Output Measure: AnyObject

Value

Measurement


user transformation constructor

Description

Construct a Transformation from user-defined callbacks.

Usage

make_user_transformation(
  input_domain,
  input_metric,
  output_domain,
  output_metric,
  function_,
  stability_map
)

Arguments

input_domain

A domain describing the set of valid inputs for the function.

input_metric

The metric from which distances between adjacent inputs are measured.

output_domain

A domain describing the set of valid outputs of the function.

output_metric

The metric from which distances between outputs of adjacent inputs are measured.

function_

A function mapping data from input_domain to output_domain.

stability_map

A function mapping distances from input_metric to output_metric.

Details

Required features: contrib, honest-but-curious

Why honest-but-curious?:

This constructor only returns a valid transformation if for every pair of elements x,xx, x' in input_domain, and for every pair ⁠(d_in, d_out)⁠, where d_in has the associated type for input_metric and d_out has the associated type for output_metric, if x,xx, x' are d_in-close under input_metric, stability_map(d_in) does not raise an exception, and stability_map(d_in) <= d_out, then ⁠function(x), function(x')⁠ are d_out-close under output_metric.

In addition, for every element xx in input_domain, ⁠function(x)⁠ is a member of output_domain or raises a data-independent runtime exception.

In addition, function must not have side-effects, and stability_map must be a pure function.

Value

Transformation


variance constructor

Description

Make a Transformation that computes the variance of bounded data.

Usage

make_variance(input_domain, input_metric, ddof = 1L, .S = "Pairwise<.T>")

Arguments

input_domain

Domain of input data

input_metric

Metric on input domain

ddof

Delta degrees of freedom. Set to 0 if not a sample, 1 for sample estimate.

.S

Summation algorithm to use on data type T. One of ⁠Sequential<T>⁠ or ⁠Pairwise<T>⁠.

Details

This uses a restricted-sensitivity proof that takes advantage of known dataset size. Use make_clamp to bound data and make_resize to establish dataset size.

Required features: contrib

make_variance in Rust documentation.

Citations:

Supporting Elements:

  • Input Domain: ⁠VectorDomain<AtomDomain<S::Item>>⁠

  • Output Domain: SymmetricDistance

  • Input Metric: ⁠AtomDomain<S::Item>⁠

  • Output Metric: ⁠AbsoluteDistance<S::Item>⁠

Value

Transformation


zCDP to approxDP constructor

Description

Constructs a new output measurement where the output measure is casted from ZeroConcentratedDivergence to SmoothedMaxDivergence.

Usage

make_zCDP_to_approxDP(measurement)

Arguments

measurement

a measurement with a privacy measure to be casted

Details

Required features: contrib

make_zCDP_to_approxDP in Rust documentation.

Value

Measurement


Construct an instance of MapDomain.

Description

Construct an instance of MapDomain.

Usage

map_domain(key_domain, value_domain)

Arguments

key_domain

domain of keys in the hashmap

value_domain

domain of values in the hashmap

Value

Domain


Privacy measure used to define ϵ\epsilon-pure differential privacy.

Description

In the following proof definition, dd corresponds to ϵ\epsilon when also quantified over all adjacent datasets. That is, ϵ\epsilon is the greatest possible dd over all pairs of adjacent datasets x,xx, x' where YM(x)Y \sim M(x), YM(x)Y' \sim M(x'). M()M(\cdot) is a measurement (commonly known as a mechanism). The measurement's input metric defines the notion of adjacency, and the measurement's input domain defines the set of possible datasets.

Usage

max_divergence()

Details

Proof Definition:

For any two distributions Y,YY, Y' and any non-negative dd, Y,YY, Y' are dd-close under the max divergence measure whenever

D(Y,Y)=maxSSupp(Y)[lnPr[YS]Pr[YS]]dD_\infty(Y, Y') = \max_{S \subseteq \textrm{Supp}(Y)} \Big[\ln \dfrac{\Pr[Y \in S]}{\Pr[Y' \in S]} \Big] \leq d.

Value

Measure


Debug a measure.

Description

Debug a measure.

Usage

measure_debug(this)

Arguments

this

The measure to debug (stringify).

Value

str


Get the distance type of a measure.

Description

Get the distance type of a measure.

Usage

measure_distance_type(this)

Arguments

this

The measure to retrieve the distance type from.

Value

str


Get the type of a measure.

Description

Get the type of a measure.

Usage

measure_type(this)

Arguments

this

The measure to retrieve the type from.

Value

str


Check the privacy relation of the measurement at the given d_in, d_out

Description

Check the privacy relation of the measurement at the given d_in, d_out

Usage

measurement_check(measurement, distance_in, distance_out)

Arguments

measurement

Measurement to check the privacy relation of.

distance_in

undocumented

distance_out

undocumented

Value

True indicates that the relation passed at the given distance.


Get the function from a measurement.

Description

Get the function from a measurement.

Usage

measurement_function(this)

Arguments

this

The measurement to retrieve the value from.

Value

Function


Get the input (carrier) data type of this.

Description

Get the input (carrier) data type of this.

Usage

measurement_input_carrier_type(this)

Arguments

this

The measurement to retrieve the type from.

Value

str


Get the input distance type of measurement.

Description

Get the input distance type of measurement.

Usage

measurement_input_distance_type(this)

Arguments

this

The measurement to retrieve the type from.

Value

str


Get the input domain from a measurement.

Description

Get the input domain from a measurement.

Usage

measurement_input_domain(this)

Arguments

this

The measurement to retrieve the value from.

Value

Domain


Get the input domain from a measurement.

Description

Get the input domain from a measurement.

Usage

measurement_input_metric(this)

Arguments

this

The measurement to retrieve the value from.

Value

Metric


Invoke the measurement with arg. Returns a differentially private release.

Description

Invoke the measurement with arg. Returns a differentially private release.

Usage

measurement_invoke(this, arg)

Arguments

this

Measurement to invoke.

arg

Input data to supply to the measurement. A member of the measurement's input domain.


Use the measurement to map a given d_in to d_out.

Description

Use the measurement to map a given d_in to d_out.

Usage

measurement_map(measurement, distance_in)

Arguments

measurement

Measurement to check the map distances with.

distance_in

Distance in terms of the input metric.


Get the output distance type of measurement.

Description

Get the output distance type of measurement.

Usage

measurement_output_distance_type(this)

Arguments

this

The measurement to retrieve the type from.

Value

str


Get the output domain from a measurement.

Description

Get the output domain from a measurement.

Usage

measurement_output_measure(this)

Arguments

this

The measurement to retrieve the value from.

Value

Measure


Debug a metric.

Description

Debug a metric.

Usage

metric_debug(this)

Arguments

this

The metric to debug (stringify).

Value

str


Get the distance type of a metric.

Description

Get the distance type of a metric.

Usage

metric_distance_type(this)

Arguments

this

The metric to retrieve the distance type from.

Value

str


Get the type of a metric.

Description

Get the type of a metric.

Usage

metric_type(this)

Arguments

this

The metric to retrieve the type from.

Value

str


new domain

Description

new domain

Usage

new_domain(ptr, log)

Arguments

ptr

a pointer to a domain

log

call history


Construct a Function from a user-defined callback. Can be used to build a postprocessor.

Description

Required features: contrib, honest-but-curious

Usage

new_function(function_, .TO)

Arguments

function_

A function mapping data to a value of type TO

.TO

Output Type

Details

new_function in Rust documentation.

Why honest-but-curious?:

An OpenDP function must satisfy two criteria. These invariants about functions are necessary to show correctness of other algorithms.

First, function must not use global state. For instance, a postprocessor that accesses the system clock time can be used to build a measurement that reveals elapsed execution time, which escalates a side-channel vulnerability into a direct vulnerability.

Secondly, function must only raise data-independent exceptions. For instance, raising an exception with the value of a DP release will both reveal the DP output and cancel the computation, potentially avoiding privacy accounting.

Value

Function


new function

Description

new function

Usage

new_function_internal(ptr, log)

Arguments

ptr

a pointer to a function

log

call history


create an instance of a hashtab from keys and values

Description

create an instance of a hashtab from keys and values

Usage

new_hashtab(keys, vals)

Arguments

keys

a vector of keys

vals

a vector of values


new measure

Description

new measure

Usage

new_measure(ptr, log)

Arguments

ptr

a pointer to a measure

log

call history


new measurement

Description

new measurement

Usage

new_measurement(ptr, log)

Arguments

ptr

pointer to the measurement struct

log

call history


new metric

Description

new metric

Usage

new_metric(ptr, log)

Arguments

ptr

a pointer to a metric

log

call history


new odometer

Description

new odometer

Usage

new_odometer(ptr, log)

Arguments

ptr

pointer to the odometer struct

log

call history


new odometer queryable

Description

new odometer queryable

Usage

new_odometer_queryable_internal(ptr)

Arguments

ptr

a pointer to an odometer queryable


Construct a PrivacyProfile from a user-defined callback.

Description

Required features: contrib, honest-but-curious

Usage

new_privacy_profile(curve)

Arguments

curve

A privacy curve mapping epsilon to delta

Details

Why honest-but-curious?:

The privacy profile should implement a well-defined δ(ϵ)\delta(\epsilon) curve:

  • monotonically decreasing

  • rejects epsilon values that are less than zero or nan

  • returns delta values only within [0,1][0, 1]


new privacy profile

Description

new privacy profile

Usage

new_privacy_profile_internal(ptr)

Arguments

ptr

a pointer to a privacy profile


Construct a queryable from a user-defined transition function.

Description

Required features: contrib

Usage

new_queryable(transition, .Q = "ExtrinsicObject", .A = "ExtrinsicObject")

Arguments

transition

A transition function taking a reference to self, a query, and an internal/external indicator

.Q

Query Type

.A

Output Type


new queryable

Description

new queryable

Usage

new_queryable_internal(ptr)

Arguments

ptr

a pointer to a queryable


new transformation

Description

new transformation

Usage

new_transformation(ptr, log)

Arguments

ptr

pointer to the transformation struct

log

call history


Internal function. Retrieve the type descriptor string of an AnyObject.

Description

Internal function. Retrieve the type descriptor string of an AnyObject.

Usage

object_type(this)

Arguments

this

A pointer to the AnyObject.

Value

str


Get the input (carrier) data type of this.

Description

Get the input (carrier) data type of this.

Usage

odometer_input_carrier_type(this)

Arguments

this

The odometer to retrieve the type from.

Value

str


Get the input domain from a odometer.

Description

Get the input domain from a odometer.

Usage

odometer_input_domain(this)

Arguments

this

The odometer to retrieve the value from.

Value

Domain


Get the input domain from a odometer.

Description

Get the input domain from a odometer.

Usage

odometer_input_metric(this)

Arguments

this

The odometer to retrieve the value from.

Value

Metric


Invoke the odometer with arg. Returns a differentially private release.

Description

Invoke the odometer with arg. Returns a differentially private release.

Usage

odometer_invoke(this, arg)

Arguments

this

Odometer to invoke.

arg

Input data to supply to the odometer. A member of the odometer's input domain.


Get the output domain from a odometer.

Description

Get the output domain from a odometer.

Usage

odometer_output_measure(this)

Arguments

this

The odometer to retrieve the value from.

Value

Measure


Eval the odometer queryable with an invoke query.

Description

Eval the odometer queryable with an invoke query.

Usage

odometer_queryable_invoke(queryable, query)

Arguments

queryable

Queryable to eval.

query

Invoke query to supply to the queryable.


Get the invoke query type of an odometer queryable.

Description

Get the invoke query type of an odometer queryable.

Usage

odometer_queryable_invoke_type(this)

Arguments

this

The queryable to retrieve the query type from.

Value

str


Retrieve the privacy loss of an odometer queryable.

Description

Retrieve the privacy loss of an odometer queryable.

Usage

odometer_queryable_privacy_loss(queryable, d_in)

Arguments

queryable

Queryable to eval.

d_in

Maximum distance between adjacent inputs in the input domain.


Get the map query type of an odometer queryable.

Description

Get the map query type of an odometer queryable.

Usage

odometer_queryable_privacy_loss_type(this)

Arguments

this

The queryable to retrieve the query type from.

Value

str


OpenDP R Bindings

Description

The OpenDP Library is a modular collection of statistical algorithms that adhere to the definition of differential privacy.

Details

More information can be found at the following locations:

Author(s)

Maintainer: Stefano Iacus [email protected]

Authors:

  • The OpenDP Project [email protected] (https://github.com/opendp/opendp/graphs/contributors)

Other contributors:

  • The authors of the dependency Rust crates (see inst/AUTHORS file for details) [contributor]

See Also

Useful links:


Construct an instance of OptionDomain.

Description

option_domain in Rust documentation.

Usage

option_domain(element_domain, .D = NULL)

Arguments

element_domain

undocumented

.D

The type of the inner domain.

Value

OptionDomain


Parse a runtime type or infer it from an example

Description

Mirrors Python's public RuntimeType.parse_or_infer(...) entrypoint.

Usage

parse_or_infer(
  type_name,
  public_example,
  generics = list(),
  allow_extrinsic = FALSE
)

Arguments

type_name

A type descriptor to normalize, or NULL.

public_example

A value to infer from when type_name is NULL.

generics

Generic type names to preserve during parsing.

allow_extrinsic

Return ExtrinsicObject for unknown host objects when TRUE.

Value

A normalized runtime_type.


Internal function. Use a PrivacyProfile to find epsilon at a given epsilon.

Description

Internal function. Use a PrivacyProfile to find epsilon at a given epsilon.

Usage

privacy_profile_delta(curve, epsilon)

Arguments

curve

The PrivacyProfile.

epsilon

What to fix epsilon to compute delta.

Value

Delta at a given epsilon.


Internal function. Use an PrivacyProfile to find epsilon at a given delta.

Description

Internal function. Use an PrivacyProfile to find epsilon at a given delta.

Usage

privacy_profile_epsilon(profile, delta)

Arguments

profile

The PrivacyProfile.

delta

What to fix delta to compute epsilon.

Value

Epsilon at a given delta.


Eval the queryable with query. Returns a differentially private release.

Description

Eval the queryable with query. Returns a differentially private release.

Usage

queryable_eval(queryable, query)

Arguments

queryable

Queryable to eval.

query

The input to the queryable.


Get the query type of queryable.

Description

Get the query type of queryable.

Usage

queryable_query_type(this)

Arguments

this

The queryable to retrieve the query type from.

Value

str


Privacy measure used to define ϵ(α)\epsilon(\alpha)-Rényi differential privacy.

Description

In the following proof definition, dd corresponds to an RDP curve when also quantified over all adjacent datasets. That is, an RDP curve ϵ(α)\epsilon(\alpha) is no smaller than d(α)d(\alpha) for any possible choices of α\alpha, and over all pairs of adjacent datasets x,xx, x' where YM(x)Y \sim M(x), YM(x)Y' \sim M(x'). M()M(\cdot) is a measurement (commonly known as a mechanism). The measurement's input metric defines the notion of adjacency, and the measurement's input domain defines the set of possible datasets.

Usage

renyi_divergence()

Details

Proof Definition:

For any two distributions Y,YY, Y' and any curve dd, Y,YY, Y' are dd-close under the Rényi divergence measure if, for any given α(1,)\alpha \in (1, \infty),

Dα(Y,Y)=11αExY[ln(Pr[Y=x]Pr[Y=x])α]d(α)D_\alpha(Y, Y') = \frac{1}{1 - \alpha} \mathbb{E}_{x \sim Y'} \Big[\ln \left( \dfrac{\Pr[Y = x]}{\Pr[Y' = x]} \right)^\alpha \Big] \leq d(\alpha)

Note that this ϵ\epsilon and α\alpha are not privacy parameters ϵ\epsilon and α\alpha until quantified over all adjacent datasets, as is done in the definition of a measurement.

Value

Measure


Infer a runtime type from a public example

Description

Mirrors Python's public RuntimeType.infer(...) entrypoint.

Usage

rt_infer(public_example, allow_extrinsic = FALSE)

Arguments

public_example

A value whose runtime type should be inferred.

allow_extrinsic

Return ExtrinsicObject for unknown host objects when TRUE.

Value

A normalized runtime_type.


Parse a runtime type descriptor into a runtime_type object

Description

Mirrors Python's public RuntimeType.parse(...) entrypoint.

Usage

rt_parse(type_name, generics = list())

Arguments

type_name

A type descriptor to normalize.

generics

Generic type names to preserve during parsing.

Value

A normalized runtime_type.


Privacy measure used to define ϵ(δ)\epsilon(\delta)-approximate differential privacy.

Description

In the following proof definition, dd corresponds to a privacy profile when also quantified over all adjacent datasets. That is, a privacy profile ϵ(δ)\epsilon(\delta) is no smaller than d(δ)d(\delta) for all possible choices of δ\delta, and over all pairs of adjacent datasets x,xx, x' where YM(x)Y \sim M(x), YM(x)Y' \sim M(x'). M()M(\cdot) is a measurement (commonly known as a mechanism). The measurement's input metric defines the notion of adjacency, and the measurement's input domain defines the set of possible datasets.

Usage

smoothed_max_divergence()

Details

The distance dd is of type PrivacyProfile, so it can be invoked with an ϵ\epsilon to retrieve the corresponding δ\delta.

Proof Definition:

For any two distributions Y,YY, Y' and any curve d()d(\cdot), Y,YY, Y' are dd-close under the smoothed max divergence measure whenever, for any choice of non-negative ϵ\epsilon, and δ=d(ϵ)\delta = d(\epsilon),

Dδ(Y,Y)=maxSSupp(Y)[lnPr[YS]+δPr[YS]]ϵD_\infty^\delta(Y, Y') = \max_{S \subseteq \textrm{Supp}(Y)} \Big[\ln \dfrac{\Pr[Y \in S] + \delta}{\Pr[Y' \in S]} \Big] \leq \epsilon.

Note that ϵ\epsilon and δ\delta are not privacy parameters ϵ\epsilon and δ\delta until quantified over all adjacent datasets, as is done in the definition of a measurement.

Value

Measure


type signature for a string

Description

type signature for a string

Usage

String

Construct an instance of the SymmetricDistance metric.

Description

Construct an instance of the SymmetricDistance metric.

Usage

symmetric_distance()

Value

Metric


partial adaptive composition constructor

Description

See documentation for make_adaptive_composition() for details.

Usage

then_adaptive_composition(lhs, output_measure, d_in, d_mids)

Arguments

lhs

The prior transformation or metric space.

output_measure

how privacy is measured

d_in

maximum distance between adjacent input datasets

d_mids

maximum privacy expenditure of each query

Value

Measurement


partial alp queryable constructor

Description

See documentation for make_alp_queryable() for details.

Usage

then_alp_queryable(
  lhs,
  scale,
  total_limit,
  value_limit = NULL,
  size_factor = 50L,
  alpha = 4L
)

Arguments

lhs

The prior transformation or metric space.

scale

Privacy loss parameter. This is equal to epsilon/sensitivity.

total_limit

Either the true value or an upper bound estimate of the sum of all values in the input.

value_limit

Upper bound on individual values (referred to as β). Entries above β are clamped.

size_factor

Optional multiplier (default of 50) for setting the size of the projection.

alpha

Optional parameter (default of 4) for scaling and determining p in randomized response step.

Value

Measurement


partial approximate constructor

Description

See documentation for make_approximate() for details.

Usage

then_approximate(lhs, measurement)

Arguments

lhs

The prior transformation or metric space.

measurement

a measurement with a privacy measure to be casted

Value

Measurement


partial b ary tree constructor

Description

See documentation for make_b_ary_tree() for details.

Usage

then_b_ary_tree(lhs, leaf_count, branching_factor)

Arguments

lhs

The prior transformation or metric space.

leaf_count

The number of leaf nodes in the b-ary tree.

branching_factor

The number of children on each branch of the resulting tree. Larger branching factors result in shallower trees.

Value

Transformation


partial basic composition constructor

Description

See documentation for make_basic_composition() for details.

Usage

then_basic_composition(lhs, measurements)

Arguments

lhs

The prior transformation or metric space.

measurements

A vector of Measurements to compose.

Value

Measurement


partial bounded float checked sum constructor

Description

See documentation for make_bounded_float_checked_sum() for details.

Usage

then_bounded_float_checked_sum(lhs, size_limit, bounds, .S = "Pairwise<.T>")

Arguments

lhs

The prior transformation or metric space.

size_limit

Upper bound on number of records to keep in the input data.

bounds

Tuple of lower and upper bounds for data in the input domain.

.S

Summation algorithm to use over some data type T (T is shorthand for S::Item)

Value

Transformation


partial bounded float ordered sum constructor

Description

See documentation for make_bounded_float_ordered_sum() for details.

Usage

then_bounded_float_ordered_sum(lhs, size_limit, bounds, .S = "Pairwise<.T>")

Arguments

lhs

The prior transformation or metric space.

size_limit

Upper bound on the number of records in input data. Used to bound sensitivity.

bounds

Tuple of lower and upper bounds for data in the input domain.

.S

Summation algorithm to use over some data type T (T is shorthand for S::Item)

Value

Transformation


partial bounded int monotonic sum constructor

Description

See documentation for make_bounded_int_monotonic_sum() for details.

Usage

then_bounded_int_monotonic_sum(lhs, bounds, .T = NULL)

Arguments

lhs

The prior transformation or metric space.

bounds

Tuple of lower and upper bounds for data in the input domain.

.T

Atomic Input Type and Output Type

Value

Transformation


partial bounded int ordered sum constructor

Description

See documentation for make_bounded_int_ordered_sum() for details.

Usage

then_bounded_int_ordered_sum(lhs, bounds, .T = NULL)

Arguments

lhs

The prior transformation or metric space.

bounds

Tuple of lower and upper bounds for data in the input domain.

.T

Atomic Input Type and Output Type

Value

Transformation


partial bounded int split sum constructor

Description

See documentation for make_bounded_int_split_sum() for details.

Usage

then_bounded_int_split_sum(lhs, bounds, .T = NULL)

Arguments

lhs

The prior transformation or metric space.

bounds

Tuple of lower and upper bounds for data in the input domain.

.T

Atomic Input Type and Output Type

Value

Transformation


partial canonical noise constructor

Description

See documentation for make_canonical_noise() for details.

Usage

then_canonical_noise(lhs, d_in, d_out)

Arguments

lhs

The prior transformation or metric space.

d_in

Sensitivity

d_out

Privacy parameters (ε, δ)

Value

Measurement


partial cast constructor

Description

See documentation for make_cast() for details.

Usage

then_cast(lhs, .TOA)

Arguments

lhs

The prior transformation or metric space.

.TOA

Atomic Output Type to cast into

Value

Transformation


partial cast default constructor

Description

See documentation for make_cast_default() for details.

Usage

then_cast_default(lhs, .TOA)

Arguments

lhs

The prior transformation or metric space.

.TOA

Atomic Output Type to cast into

Value

Transformation


partial cast inherent constructor

Description

See documentation for make_cast_inherent() for details.

Usage

then_cast_inherent(lhs, .TOA)

Arguments

lhs

The prior transformation or metric space.

.TOA

Atomic Output Type to cast into

Value

Transformation


partial cdf constructor

Description

See documentation for make_cdf() for details.

Usage

then_cdf(lhs, .TA = "float")

Arguments

lhs

The prior transformation or metric space.

.TA

Atomic Type. One of f32 or f64

Value

Function


partial chain mt constructor

Description

See documentation for make_chain_mt() for details.

Usage

then_chain_mt(lhs, measurement1, transformation0)

Arguments

lhs

The prior transformation or metric space.

measurement1

outer mechanism

transformation0

inner transformation

Value

Measurement


partial chain pm constructor

Description

See documentation for make_chain_pm() for details.

Usage

then_chain_pm(lhs, postprocess1, measurement0)

Arguments

lhs

The prior transformation or metric space.

postprocess1

outer postprocessor

measurement0

inner measurement/mechanism

Value

Measurement


partial chain tt constructor

Description

See documentation for make_chain_tt() for details.

Usage

then_chain_tt(lhs, transformation1, transformation0)

Arguments

lhs

The prior transformation or metric space.

transformation1

outer transformation

transformation0

inner transformation

Value

Transformation


partial clamp constructor

Description

See documentation for make_clamp() for details.

Usage

then_clamp(lhs, bounds)

Arguments

lhs

The prior transformation or metric space.

bounds

Tuple of inclusive lower and upper bounds.

Value

Transformation


partial composition constructor

Description

See documentation for make_composition() for details.

Usage

then_composition(lhs, measurements)

Arguments

lhs

The prior transformation or metric space.

measurements

A vector of Measurements to compose.

Value

Measurement


partial consistent b ary tree constructor

Description

See documentation for make_consistent_b_ary_tree() for details.

Usage

then_consistent_b_ary_tree(lhs, branching_factor, .TIA = "int", .TOA = "float")

Arguments

lhs

The prior transformation or metric space.

branching_factor

the maximum number of children

.TIA

Atomic type of the input data. Should be an integer type.

.TOA

Atomic type of the output data. Should be a float type.

Value

Function


partial count constructor

Description

See documentation for make_count() for details.

Usage

then_count(lhs, .TO = "int")

Arguments

lhs

The prior transformation or metric space.

.TO

Output Type. Must be numeric.

Value

Transformation


partial count by constructor

Description

See documentation for make_count_by() for details.

Usage

then_count_by(lhs, .TV = "int")

Arguments

lhs

The prior transformation or metric space.

.TV

Type of Value. Express counts in terms of this integral type.

Value

The carrier type is ⁠HashMap<TK, TV>⁠, a hashmap of the count (TV) for each unique data input (TK).


partial count by categories constructor

Description

See documentation for make_count_by_categories() for details.

Usage

then_count_by_categories(
  lhs,
  categories,
  null_category = TRUE,
  .MO = "L1Distance<int>",
  .TOA = "int"
)

Arguments

lhs

The prior transformation or metric space.

categories

The set of categories to compute counts for.

null_category

Include a count of the number of elements that were not in the category set at the end of the vector.

.MO

Output Metric.

.TOA

Atomic Output Type that is numeric.

Value

The carrier type is ⁠Vec<TOA>⁠, a vector of the counts (TOA).


partial count distinct constructor

Description

See documentation for make_count_distinct() for details.

Usage

then_count_distinct(lhs, .TO = "int")

Arguments

lhs

The prior transformation or metric space.

.TO

Output Type. Must be numeric.

Value

Transformation


partial create dataframe constructor

Description

See documentation for make_create_dataframe() for details.

Usage

then_create_dataframe(lhs, col_names, .K = NULL)

Arguments

lhs

The prior transformation or metric space.

col_names

Column names for each record entry.

.K

categorical/hashable data type of column names

Value

Transformation


partial df cast default constructor

Description

See documentation for make_df_cast_default() for details.

Usage

then_df_cast_default(lhs, column_name, .TIA, .TOA)

Arguments

lhs

The prior transformation or metric space.

column_name

column name to be transformed

.TIA

Atomic Input Type to cast from

.TOA

Atomic Output Type to cast into

Value

Transformation


partial df is equal constructor

Description

See documentation for make_df_is_equal() for details.

Usage

then_df_is_equal(lhs, column_name, value, .TIA = NULL)

Arguments

lhs

The prior transformation or metric space.

column_name

Column name to be transformed

value

Value to check for equality

.TIA

Atomic Input Type to cast from

Value

Transformation


partial drop null constructor

Description

See documentation for make_drop_null() for details.

Usage

then_drop_null(lhs)

Arguments

lhs

The prior transformation or metric space.

Value

Transformation


partial find constructor

Description

See documentation for make_find() for details.

Usage

then_find(lhs, categories)

Arguments

lhs

The prior transformation or metric space.

categories

The set of categories to find indexes from.

Value

Transformation


partial find bin constructor

Description

See documentation for make_find_bin() for details.

Usage

then_find_bin(lhs, edges)

Arguments

lhs

The prior transformation or metric space.

edges

The set of edges to split bins by.

Value

Transformation


partial fix delta constructor

Description

See documentation for make_fix_delta() for details.

Usage

then_fix_delta(lhs, measurement, delta)

Arguments

lhs

The prior transformation or metric space.

measurement

a measurement with a privacy curve to be fixed

delta

parameter to fix the privacy curve with

Value

Measurement


partial fixed approxDP to approxDP constructor

Description

See documentation for make_fixed_approxDP_to_approxDP() for details.

Usage

then_fixed_approxDP_to_approxDP(lhs, measurement)

Arguments

lhs

The prior transformation or metric space.

measurement

a measurement with a privacy measure to be casted

Value

Measurement


partial fully adaptive composition constructor

Description

See documentation for make_fully_adaptive_composition() for details.

Usage

then_fully_adaptive_composition(lhs, output_measure)

Arguments

lhs

The prior transformation or metric space.

output_measure

how privacy is measured

Value

Odometer


partial gaussian constructor

Description

See documentation for make_gaussian() for details.

Usage

then_gaussian(lhs, scale, k = NULL, .MO = "ZeroConcentratedDivergence")

Arguments

lhs

The prior transformation or metric space.

scale

Noise scale parameter for the gaussian distribution. scale == standard_deviation.

k

The noise granularity in terms of 2^k.

.MO

Output Measure. The only valid measure is ZeroConcentratedDivergence.

Value

Measurement

Examples

library(opendp)
enable_features("contrib")
gaussian <- make_gaussian(
  atom_domain(.T = f64, nan = FALSE),
  absolute_distance(.T = f64),
  scale = 1.0)
gaussian(arg = 100.0)

# Or, more readably, define the space and then chain:
space <- c(atom_domain(.T = f64, nan = FALSE), absolute_distance(.T = f64))
gaussian <- space |> then_gaussian(scale = 1.0)
gaussian(arg = 100.0)

# Sensitivity of this measurement:
gaussian(d_in = 1)
gaussian(d_in = 2)
gaussian(d_in = 4)

# Typically will be used with vectors rather than individual numbers:
space <- c(vector_domain(atom_domain(.T = i32)), l2_distance(.T = i32))
gaussian <- space |> then_gaussian(scale = 1.0)
gaussian(arg = c(10L, 20L, 30L))

partial gaussian threshold constructor

Description

See documentation for make_gaussian_threshold() for details.

Usage

then_gaussian_threshold(
  lhs,
  scale,
  threshold,
  k = NULL,
  .MO = "Approximate<ZeroConcentratedDivergence>"
)

Arguments

lhs

The prior transformation or metric space.

scale

Noise scale parameter for the laplace distribution. scale == standard_deviation / sqrt(2).

threshold

Exclude pairs with values whose distance from zero exceeds this value.

k

The noise granularity in terms of 2^k.

.MO

Output Measure.

Value

Measurement


partial geometric constructor

Description

See documentation for make_geometric() for details.

Usage

then_geometric(lhs, scale, bounds = NULL, .MO = "MaxDivergence")

Arguments

lhs

The prior transformation or metric space.

scale

Noise scale parameter for the distribution. scale == standard_deviation / sqrt(2).

bounds

Set bounds on the count to make the algorithm run in constant-time.

.MO

Measure used to quantify privacy loss. Valid values are just MaxDivergence

Value

Measurement


partial identity constructor

Description

See documentation for make_identity() for details.

Usage

then_identity(lhs)

Arguments

lhs

The prior transformation or metric space.

Value

Transformation


partial impute constant constructor

Description

See documentation for make_impute_constant() for details.

Usage

then_impute_constant(lhs, constant)

Arguments

lhs

The prior transformation or metric space.

constant

Value to replace nulls with.

Value

Transformation


partial impute uniform float constructor

Description

See documentation for make_impute_uniform_float() for details.

Usage

then_impute_uniform_float(lhs, bounds)

Arguments

lhs

The prior transformation or metric space.

bounds

Tuple of inclusive lower and upper bounds.

Value

Transformation


partial index constructor

Description

See documentation for make_index() for details.

Usage

then_index(lhs, categories, null, .TOA = NULL)

Arguments

lhs

The prior transformation or metric space.

categories

The set of categories to index into.

null

Category to return if the index is out-of-range of the category set.

.TOA

Atomic Output Type. Output data will be ⁠Vec<TOA>⁠.

Value

Transformation


partial is equal constructor

Description

See documentation for make_is_equal() for details.

Usage

then_is_equal(lhs, value)

Arguments

lhs

The prior transformation or metric space.

value

value to check against

Value

Transformation


partial is null constructor

Description

See documentation for make_is_null() for details.

Usage

then_is_null(lhs)

Arguments

lhs

The prior transformation or metric space.

Value

Transformation


partial laplace constructor

Description

See documentation for make_laplace() for details.

Usage

then_laplace(lhs, scale, k = NULL, .MO = "MaxDivergence")

Arguments

lhs

The prior transformation or metric space.

scale

Noise scale parameter for the Laplace distribution. scale == standard_deviation / sqrt(2).

k

The noise granularity in terms of 2^k, only valid for domains over floats.

.MO

Measure used to quantify privacy loss. Valid values are just MaxDivergence

Value

Measurement


partial laplace threshold constructor

Description

See documentation for make_laplace_threshold() for details.

Usage

then_laplace_threshold(
  lhs,
  scale,
  threshold,
  k = NULL,
  .MO = "Approximate<MaxDivergence>"
)

Arguments

lhs

The prior transformation or metric space.

scale

Noise scale parameter for the laplace distribution. scale == standard_deviation / sqrt(2).

threshold

Exclude counts that are less than this minimum value.

k

The noise granularity in terms of 2^k.

.MO

Output Measure.

Value

Measurement


partial lipschitz float mul constructor

Description

See documentation for make_lipschitz_float_mul() for details.

Usage

then_lipschitz_float_mul(lhs, constant, bounds)

Arguments

lhs

The prior transformation or metric space.

constant

The constant to multiply aggregates by.

bounds

Tuple of inclusive lower and upper bounds.

Value

Transformation


partial mean constructor

Description

See documentation for make_mean() for details.

Usage

then_mean(lhs)

Arguments

lhs

The prior transformation or metric space.

Value

Transformation


partial metric bounded constructor

Description

See documentation for make_metric_bounded() for details.

Usage

then_metric_bounded(lhs)

Arguments

lhs

The prior transformation or metric space.

Value

Transformation


partial metric unbounded constructor

Description

See documentation for make_metric_unbounded() for details.

Usage

then_metric_unbounded(lhs)

Arguments

lhs

The prior transformation or metric space.

Value

Transformation


partial noise constructor

Description

See documentation for make_noise() for details.

Usage

then_noise(lhs, output_measure, scale, k = NULL)

Arguments

lhs

The prior transformation or metric space.

output_measure

Privacy measure. Either MaxDivergence or ZeroConcentratedDivergence.

scale

Noise scale parameter.

k

The noise granularity in terms of 2^k.

Value

Measurement


partial noise threshold constructor

Description

See documentation for make_noise_threshold() for details.

Usage

then_noise_threshold(lhs, output_measure, scale, threshold, k = NULL)

Arguments

lhs

The prior transformation or metric space.

output_measure

Privacy measure. Either MaxDivergence or ZeroConcentratedDivergence.

scale

Noise scale parameter for the laplace distribution. scale == standard_deviation / sqrt(2).

threshold

Exclude counts that are less than this minimum value.

k

The noise granularity in terms of 2^k.

Value

Measurement


partial noisy max constructor

Description

See documentation for make_noisy_max() for details.

Usage

then_noisy_max(lhs, output_measure, scale, negate = FALSE)

Arguments

lhs

The prior transformation or metric space.

output_measure

One of MaxDivergence, ZeroConcentratedDivergence

scale

Scale for the noise distribution

negate

Set to true to return min

Value

Measurement


partial noisy top k constructor

Description

See documentation for make_noisy_top_k() for details.

Usage

then_noisy_top_k(lhs, output_measure, k, scale, negate = FALSE)

Arguments

lhs

The prior transformation or metric space.

output_measure

One of MaxDivergence or ZeroConcentratedDivergence

k

Number of indices to select.

scale

Scale for the noise distribution.

negate

Set to true to return bottom k

Value

Measurement


partial ordered random constructor

Description

See documentation for make_ordered_random() for details.

Usage

then_ordered_random(lhs)

Arguments

lhs

The prior transformation or metric space.

Value

Transformation


partial population amplification constructor

Description

See documentation for make_population_amplification() for details.

Usage

then_population_amplification(lhs, measurement, population_size)

Arguments

lhs

The prior transformation or metric space.

measurement

the computation to amplify

population_size

the size of the population from which the input dataset is a simple sample

Value

Measurement


Compose a measurement with a postprocessing function.

Description

This provides Python-like ergonomics for chaining a pure function after a measurement release.

Usage

then_postprocess(lhs, f, .TO = "ExtrinsicObject")

Arguments

lhs

A measurement to postprocess.

f

A pure postprocessing function applied to the release.

.TO

The runtime type of the postprocessed output.

Value

A composed measurement.


partial privacy filter constructor

Description

See documentation for make_privacy_filter() for details.

Usage

then_privacy_filter(lhs, odometer, d_in, d_out)

Arguments

lhs

The prior transformation or metric space.

odometer

A privacy odometer

d_in

Upper bound on the distance between adjacent datasets

d_out

Upper bound on the privacy loss

Value

Measurement


partial private quantile constructor

Description

See documentation for make_private_quantile() for details.

Usage

then_private_quantile(lhs, output_measure, candidates, alpha, scale)

Arguments

lhs

The prior transformation or metric space.

output_measure

Either MaxDivergence or ZeroConcentratedDivergence.

candidates

Potential quantiles to score

alpha

a value in [0,1][0, 1]. Choose 0.5 for median

scale

the scale of the noise added

Value

Measurement


partial pureDP to zCDP constructor

Description

See documentation for make_pureDP_to_zCDP() for details.

Usage

then_pureDP_to_zCDP(lhs, measurement)

Arguments

lhs

The prior transformation or metric space.

measurement

a measurement with a privacy measure to be casted

Value

Measurement


partial quantile score candidates constructor

Description

See documentation for make_quantile_score_candidates() for details.

Usage

then_quantile_score_candidates(lhs, candidates, alpha)

Arguments

lhs

The prior transformation or metric space.

candidates

Potential quantiles to score

alpha

a value in [0,1][0, 1]. Choose 0.5 for median

Value

Transformation


partial quantiles from counts constructor

Description

See documentation for make_quantiles_from_counts() for details.

Usage

then_quantiles_from_counts(
  lhs,
  bin_edges,
  alphas,
  interpolation = "linear",
  .TA = NULL,
  .F = "float"
)

Arguments

lhs

The prior transformation or metric space.

bin_edges

The edges that the input data was binned into before counting.

alphas

Return all specified alpha-quantiles.

interpolation

Must be one of linear or nearest

.TA

Atomic Type of the bin edges and data.

.F

Float type of the alpha argument. One of f32 or f64

Value

Function


partial randomized response constructor

Description

See documentation for make_randomized_response() for details.

Usage

then_randomized_response(lhs, categories, prob, .T = NULL)

Arguments

lhs

The prior transformation or metric space.

categories

Set of valid outcomes

prob

Probability of returning the correct answer. Must be in ⁠[1/num_categories, 1]⁠

.T

Data type of a category.

Value

Measurement


partial randomized response bitvec constructor

Description

See documentation for make_randomized_response_bitvec() for details.

Usage

then_randomized_response_bitvec(lhs, f, constant_time = FALSE)

Arguments

lhs

The prior transformation or metric space.

f

Per-bit flipping probability. Must be in (0,1](0, 1].

constant_time

Whether to run the Bernoulli samplers in constant time, this is likely to be extremely slow.

Value

Measurement


partial randomized response bool constructor

Description

See documentation for make_randomized_response_bool() for details.

Usage

then_randomized_response_bool(lhs, prob, constant_time = FALSE)

Arguments

lhs

The prior transformation or metric space.

prob

Probability of returning the correct answer. Must be in ⁠[0.5, 1]⁠

constant_time

Set to true to enable constant time. Slower.

Value

Measurement


partial report noisy max gumbel constructor

Description

See documentation for make_report_noisy_max_gumbel() for details.

Usage

then_report_noisy_max_gumbel(lhs, scale, optimize = "max")

Arguments

lhs

The prior transformation or metric space.

scale

Scale for the noise distribution

optimize

Set to "min" to report noisy min

Value

Measurement


partial resize constructor

Description

See documentation for make_resize() for details.

Usage

then_resize(lhs, size, constant, .MO = "SymmetricDistance")

Arguments

lhs

The prior transformation or metric space.

size

Number of records in output data.

constant

Value to impute with.

.MO

Output Metric. One of InsertDeleteDistance or SymmetricDistance

Value

A vector of the same type TA, but with the provided size.


partial select column constructor

Description

See documentation for make_select_column() for details.

Usage

then_select_column(lhs, key, .TOA, .K = NULL)

Arguments

lhs

The prior transformation or metric space.

key

categorical/hashable data type of the key/column name

.TOA

Atomic Output Type to downcast vector to

.K

data type of key

Value

Transformation


partial select private candidate constructor

Description

See documentation for make_select_private_candidate() for details.

Usage

then_select_private_candidate(lhs, measurement, stop_probability, threshold)

Arguments

lhs

The prior transformation or metric space.

measurement

A measurement that releases a 2-tuple of (score, candidate)

stop_probability

The probability of stopping early at any iteration.

threshold

The threshold score. Return immediately if the score is above this threshold.

Value

A measurement that returns a release from measurement whose score is greater than threshold, or none.


partial sequential composition constructor

Description

See documentation for make_sequential_composition() for details.

Usage

then_sequential_composition(lhs, output_measure, d_in, d_mids)

Arguments

lhs

The prior transformation or metric space.

output_measure

how privacy is measured

d_in

maximum distance between adjacent input datasets

d_mids

maximum privacy expenditure of each query

Value

Measurement


partial sized bounded float checked sum constructor

Description

See documentation for make_sized_bounded_float_checked_sum() for details.

Usage

then_sized_bounded_float_checked_sum(lhs, size, bounds, .S = "Pairwise<.T>")

Arguments

lhs

The prior transformation or metric space.

size

Number of records in input data.

bounds

Tuple of lower and upper bounds for data in the input domain.

.S

Summation algorithm to use over some data type T (T is shorthand for S::Item)

Value

Transformation


partial sized bounded float ordered sum constructor

Description

See documentation for make_sized_bounded_float_ordered_sum() for details.

Usage

then_sized_bounded_float_ordered_sum(lhs, size, bounds, .S = "Pairwise<.T>")

Arguments

lhs

The prior transformation or metric space.

size

Number of records in input data.

bounds

Tuple of lower and upper bounds for data in the input domain.

.S

Summation algorithm to use over some data type T (T is shorthand for S::Item)

Value

Transformation


partial sized bounded int checked sum constructor

Description

See documentation for make_sized_bounded_int_checked_sum() for details.

Usage

then_sized_bounded_int_checked_sum(lhs, size, bounds, .T = NULL)

Arguments

lhs

The prior transformation or metric space.

size

Number of records in input data.

bounds

Tuple of lower and upper bounds for data in the input domain.

.T

Atomic Input Type and Output Type

Value

Transformation


partial sized bounded int monotonic sum constructor

Description

See documentation for make_sized_bounded_int_monotonic_sum() for details.

Usage

then_sized_bounded_int_monotonic_sum(lhs, size, bounds, .T = NULL)

Arguments

lhs

The prior transformation or metric space.

size

Number of records in input data.

bounds

Tuple of lower and upper bounds for data in the input domain.

.T

Atomic Input Type and Output Type

Value

Transformation


partial sized bounded int ordered sum constructor

Description

See documentation for make_sized_bounded_int_ordered_sum() for details.

Usage

then_sized_bounded_int_ordered_sum(lhs, size, bounds, .T = NULL)

Arguments

lhs

The prior transformation or metric space.

size

Number of records in input data.

bounds

Tuple of lower and upper bounds for data in the input domain.

.T

Atomic Input Type and Output Type

Value

Transformation


partial sized bounded int split sum constructor

Description

See documentation for make_sized_bounded_int_split_sum() for details.

Usage

then_sized_bounded_int_split_sum(lhs, size, bounds, .T = NULL)

Arguments

lhs

The prior transformation or metric space.

size

Number of records in input data.

bounds

Tuple of lower and upper bounds for data in the input domain.

.T

Atomic Input Type and Output Type

Value

Transformation


partial split dataframe constructor

Description

See documentation for make_split_dataframe() for details.

Usage

then_split_dataframe(lhs, separator, col_names, .K = NULL)

Arguments

lhs

The prior transformation or metric space.

separator

The token(s) that separate entries in each record.

col_names

Column names for each record entry.

.K

categorical/hashable data type of column names

Value

Transformation


partial split lines constructor

Description

See documentation for make_split_lines() for details.

Usage

then_split_lines(lhs)

Arguments

lhs

The prior transformation or metric space.

Value

Transformation


partial split records constructor

Description

See documentation for make_split_records() for details.

Usage

then_split_records(lhs, separator)

Arguments

lhs

The prior transformation or metric space.

separator

The token(s) that separate entries in each record.

Value

Transformation


partial subset by constructor

Description

See documentation for make_subset_by() for details.

Usage

then_subset_by(lhs, indicator_column, keep_columns, .TK = NULL)

Arguments

lhs

The prior transformation or metric space.

indicator_column

name of the boolean column that indicates inclusion in the subset

keep_columns

list of column names to apply subset to

.TK

Type of the column name

Value

Transformation


partial sum constructor

Description

See documentation for make_sum() for details.

Usage

then_sum(lhs)

Arguments

lhs

The prior transformation or metric space.

Value

Transformation


partial sum of squared deviations constructor

Description

See documentation for make_sum_of_squared_deviations() for details.

Usage

then_sum_of_squared_deviations(lhs, .S = "Pairwise<.T>")

Arguments

lhs

The prior transformation or metric space.

.S

Summation algorithm to use on data type T. One of ⁠Sequential<T>⁠ or ⁠Pairwise<T>⁠.

Value

Transformation


partial unordered constructor

Description

See documentation for make_unordered() for details.

Usage

then_unordered(lhs)

Arguments

lhs

The prior transformation or metric space.

Value

Transformation


partial user measurement constructor

Description

See documentation for make_user_measurement() for details.

Usage

then_user_measurement(
  lhs,
  output_measure,
  function_,
  privacy_map,
  .TO = "ExtrinsicObject"
)

Arguments

lhs

The prior transformation or metric space.

output_measure

The measure from which distances between adjacent output distributions are measured.

function_

A function mapping data from input_domain to a release of type TO.

privacy_map

A function mapping distances from input_metric to output_measure.

.TO

The data type of outputs from the function.

Value

Measurement


partial user transformation constructor

Description

See documentation for make_user_transformation() for details.

Usage

then_user_transformation(
  lhs,
  input_domain,
  input_metric,
  output_domain,
  output_metric,
  function_,
  stability_map
)

Arguments

lhs

The prior transformation or metric space.

input_domain

A domain describing the set of valid inputs for the function.

input_metric

The metric from which distances between adjacent inputs are measured.

output_domain

A domain describing the set of valid outputs of the function.

output_metric

The metric from which distances between outputs of adjacent inputs are measured.

function_

A function mapping data from input_domain to output_domain.

stability_map

A function mapping distances from input_metric to output_metric.

Value

Transformation


partial variance constructor

Description

See documentation for make_variance() for details.

Usage

then_variance(lhs, ddof = 1L, .S = "Pairwise<.T>")

Arguments

lhs

The prior transformation or metric space.

ddof

Delta degrees of freedom. Set to 0 if not a sample, 1 for sample estimate.

.S

Summation algorithm to use on data type T. One of ⁠Sequential<T>⁠ or ⁠Pairwise<T>⁠.

Value

Transformation


partial zCDP to approxDP constructor

Description

See documentation for make_zCDP_to_approxDP() for details.

Usage

then_zCDP_to_approxDP(lhs, measurement)

Arguments

lhs

The prior transformation or metric space.

measurement

a measurement with a privacy measure to be casted

Value

Measurement


Convert a format-able value to a string representation

Description

Convert a format-able value to a string representation

Usage

## Default S3 method:
to_str(x, depth)

Arguments

x

value to convert to string

depth

offset from start of string


Convert hashtab to a string representation

Description

Convert hashtab to a string representation

Usage

## S3 method for class 'hashtab'
to_str(x, depth = 0L)

Arguments

x

value to convert to string

depth

offset from start of string


Convert a make_ constructor into a then_ constructor.

Description

This mirrors the Python extras utility for constructors whose first two arguments are input_domain and input_metric.

Usage

to_then(constructor)

Arguments

constructor

A constructor whose first two arguments are input_domain and input_metric.

Value

A partial constructor suitable for ⁠|>⁠ chaining.


Check the privacy relation of the measurement at the given d_in, d_out

Description

Check the privacy relation of the measurement at the given d_in, d_out

Usage

transformation_check(transformation, distance_in, distance_out)

Arguments

transformation

undocumented

distance_in

undocumented

distance_out

undocumented

Value

True indicates that the relation passed at the given distance.


Get the function from a transformation.

Description

Get the function from a transformation.

Usage

transformation_function(this)

Arguments

this

The transformation to retrieve the value from.

Value

Function


Get the input (carrier) data type of this.

Description

Get the input (carrier) data type of this.

Usage

transformation_input_carrier_type(this)

Arguments

this

The transformation to retrieve the type from.

Value

str


Get the input distance type of transformation.

Description

Get the input distance type of transformation.

Usage

transformation_input_distance_type(this)

Arguments

this

The transformation to retrieve the type from.

Value

str


Get the input domain from a transformation.

Description

Get the input domain from a transformation.

Usage

transformation_input_domain(this)

Arguments

this

The transformation to retrieve the value from.

Value

Domain


Get the input domain from a transformation.

Description

Get the input domain from a transformation.

Usage

transformation_input_metric(this)

Arguments

this

The transformation to retrieve the value from.

Value

Metric


Invoke the transformation with arg. Returns a differentially private release.

Description

Invoke the transformation with arg. Returns a differentially private release.

Usage

transformation_invoke(this, arg)

Arguments

this

Transformation to invoke.

arg

Input data to supply to the transformation. A member of the transformation's input domain.


Use the transformation to map a given d_in to d_out.

Description

Use the transformation to map a given d_in to d_out.

Usage

transformation_map(transformation, distance_in)

Arguments

transformation

Transformation to check the map distances with.

distance_in

Distance in terms of the input metric.


Get the output distance type of transformation.

Description

Get the output distance type of transformation.

Usage

transformation_output_distance_type(this)

Arguments

this

The transformation to retrieve the type from.

Value

str


Get the output domain from a transformation.

Description

Get the output domain from a transformation.

Usage

transformation_output_domain(this)

Arguments

this

The transformation to retrieve the value from.

Value

Domain


Get the output domain from a transformation.

Description

Get the output domain from a transformation.

Usage

transformation_output_metric(this)

Arguments

this

The transformation to retrieve the value from.

Value

Metric


type signature for a 128-bit unsigned integer

Description

type signature for a 128-bit unsigned integer

Usage

u128

type signature for a 16-bit unsigned integer

Description

type signature for a 16-bit unsigned integer

Usage

u16

type signature for a 32-bit unsigned integer

Description

type signature for a 32-bit unsigned integer

Usage

u32

type signature for a 64-bit unsigned integer

Description

type signature for a 64-bit unsigned integer

Usage

u64

type signature for an 8-bit unsigned integer

Description

type signature for an 8-bit unsigned integer

Usage

u8

Construct a new UserDistance. Any two instances of an UserDistance are equal if their string descriptors are equal.

Description

Required features: honest-but-curious

Usage

user_distance(identifier, descriptor = NULL)

Arguments

identifier

A string description of the metric.

descriptor

Additional constraints on the domain.

Details

Why honest-but-curious?:

Your definition of d must satisfy the requirements of a pseudo-metric:

  1. for any xx, d(x,x)=0d(x, x) = 0

  2. for any x,yx, y, d(x,y)0d(x, y) \ge 0 (non-negativity)

  3. for any x,yx, y, d(x,y)=d(y,x)d(x, y) = d(y, x) (symmetry)

  4. for any x,y,zx, y, z, d(x,z)d(x,y)+d(y,z)d(x, z) \le d(x, y) + d(y, z) (triangle inequality)

Value

Metric


Privacy measure with meaning defined by an OpenDP Library user (you).

Description

Any two instances of UserDivergence are equal if their descriptors compare equal.

Usage

user_divergence(identifier, descriptor = NULL)

Arguments

identifier

A string description of the privacy measure.

descriptor

Additional constraints on the privacy measure.

Details

Required features: honest-but-curious

Why honest-but-curious?:

The essential requirement of a privacy measure is that it is closed under postprocessing. Your privacy measure D must satisfy that, for any pure function f and any two distributions ⁠Y, Y'⁠, then D(Y,Y)D(f(Y),f(Y))D(Y, Y') \ge D(f(Y), f(Y')).

Beyond this, you should also consider whether your privacy measure can be used to provide meaningful privacy guarantees to your privacy units.

Value

Measure


Construct a new UserDomain. Any two instances of an UserDomain are equal if their string descriptors are equal. Contains a function used to check if any value is a member of the domain.

Description

Required features: honest-but-curious

Usage

user_domain(identifier, member, descriptor = NULL)

Arguments

identifier

A string description of the data domain.

member

A function used to test if a value is a member of the data domain.

descriptor

Additional constraints on the domain.

Details

Why honest-but-curious?:

The identifier must uniquely identify this domain. If the identifier is not uniquely identifying, then two different domains with the same identifier will chain, which can violate transformation stability.

In addition, the member function must:

  1. be a pure function

  2. be sound (only return true if its input is a member of the domain).

Value

Domain


type signature for a pointer-sized unsigned integer

Description

type signature for a pointer-sized unsigned integer

Usage

usize

Construct an instance of VectorDomain.

Description

Construct an instance of VectorDomain.

Usage

vector_domain(atom_domain, size = NULL)

Arguments

atom_domain

The inner domain.

size

undocumented

Value

VectorDomain


Privacy measure used to define ρ\rho-zero concentrated differential privacy.

Description

In the following proof definition, dd corresponds to ρ\rho when also quantified over all adjacent datasets. That is, ρ\rho is the greatest possible dd over all pairs of adjacent datasets x,xx, x' where YM(x)Y \sim M(x), YM(x)Y' \sim M(x'). M()M(\cdot) is a measurement (commonly known as a mechanism). The measurement's input metric defines the notion of adjacency, and the measurement's input domain defines the set of possible datasets.

Usage

zero_concentrated_divergence()

Details

Proof Definition:

For any two distributions Y,YY, Y' and any non-negative dd, Y,YY, Y' are dd-close under the zero-concentrated divergence measure if, for every possible choice of α(1,)\alpha \in (1, \infty),

Dα(Y,Y)=11αExY[ln(Pr[Y=x]Pr[Y=x])α]dαD_\alpha(Y, Y') = \frac{1}{1 - \alpha} \mathbb{E}_{x \sim Y'} \Big[\ln \left( \dfrac{\Pr[Y = x]}{\Pr[Y' = x]} \right)^\alpha \Big] \leq d \cdot \alpha.

Value

Measure