opendp.transformations module#
The transformations
module provides functions that deterministicly transform datasets.
For more context, see transformations in the User Guide.
For convenience, all the functions of this module are also available from opendp.prelude
.
We suggest importing under the conventional name dp
:
>>> import opendp.prelude as dp
The methods of this module will then be accessible at dp.t
.
- opendp.transformations.choose_branching_factor(size_guess)[source]#
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.Required features:
contrib
choose_branching_factor in Rust documentation.
Citations:
- Parameters:
size_guess (int) – A guess at the size of your dataset.
- Return type:
int
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
- opendp.transformations.make_b_ary_tree(input_domain, input_metric, leaf_count, branching_factor)[source]#
Expand a vector of counts into a b-ary tree of counts, where each branch is the sum of its
b
immediate children.Required features:
contrib
make_b_ary_tree in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<TA>>
Output Domain:
VectorDomain<AtomDomain<TA>>
Input Metric:
M
Output Metric:
M
- Parameters:
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_bounded_float_checked_sum(size_limit, bounds, S='Pairwise<T>')[source]#
Make a Transformation that computes the sum of bounded data with known dataset size.
This uses a restricted-sensitivity proof that takes advantage of known dataset size for better utility. Use
make_clamp
to bound data andmake_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, setS
toPairwise<f32>
.Required features:
contrib
make_bounded_float_checked_sum in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<S::Item>>
Output Domain:
AtomDomain<S::Item>
Input Metric:
SymmetricDistance
Output Metric:
AbsoluteDistance<S::Item>
- Parameters:
size_limit (int) – Upper bound on number of records to keep in the input data.
bounds (tuple[Any, Any]) – Tuple of lower and upper bounds for data in the input domain.
S (Type Argument) – Summation algorithm to use over some data type
T
(T
is shorthand forS::Item
)
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_bounded_float_ordered_sum(size_limit, bounds, S='Pairwise<T>')[source]#
Make a Transformation that computes the sum of bounded floats with known ordering.
Only useful when
make_bounded_float_checked_sum
returns an error due to potential for overflow. You may need to usemake_ordered_random
to impose an ordering on the data. The utility loss from overestimating thesize_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, setS
toPairwise<f32>
.Required features:
contrib
make_bounded_float_ordered_sum in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<S::Item>>
Output Domain:
AtomDomain<S::Item>
Input Metric:
InsertDeleteDistance
Output Metric:
AbsoluteDistance<S::Item>
- Parameters:
size_limit (int) – Upper bound on the number of records in input data. Used to bound sensitivity.
bounds (tuple[Any, Any]) – Tuple of lower and upper bounds for data in the input domain.
S (Type Argument) – Summation algorithm to use over some data type
T
(T
is shorthand forS::Item
)
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_bounded_int_monotonic_sum(bounds, T=None)[source]#
Make a Transformation that computes the sum of bounded ints, where all values share the same sign.
Required features:
contrib
make_bounded_int_monotonic_sum in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<T>>
Output Domain:
AtomDomain<T>
Input Metric:
SymmetricDistance
Output Metric:
AbsoluteDistance<T>
- Parameters:
bounds (tuple[Any, Any]) – Tuple of lower and upper bounds for data in the input domain.
T (Type Argument) – Atomic Input Type and Output Type
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_bounded_int_ordered_sum(bounds, T=None)[source]#
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.Required features:
contrib
make_bounded_int_ordered_sum in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<T>>
Output Domain:
AtomDomain<T>
Input Metric:
InsertDeleteDistance
Output Metric:
AbsoluteDistance<T>
- Parameters:
bounds (tuple[Any, Any]) – Tuple of lower and upper bounds for data in the input domain.
T (Type Argument) – Atomic Input Type and Output Type
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_bounded_int_split_sum(bounds, T=None)[source]#
Make a Transformation that computes the sum of bounded ints. Adds the saturating sum of the positives to the saturating sum of the negatives.
Required features:
contrib
make_bounded_int_split_sum in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<T>>
Output Domain:
AtomDomain<T>
Input Metric:
SymmetricDistance
Output Metric:
AbsoluteDistance<T>
- Parameters:
bounds (tuple[Any, Any]) – Tuple of lower and upper bounds for data in the input domain.
T (Type Argument) – Atomic Input Type and Output Type
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_cast(input_domain, input_metric, TOA)[source]#
Make a Transformation that casts a vector of data from type
TIA
to typeTOA
. For each element, failure to parse results inNone
, elseSome(out)
.Can be chained with
make_impute_constant
ormake_drop_null
to handle nullity.Required features:
contrib
make_cast in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<TIA>>
Output Domain:
VectorDomain<OptionDomain<AtomDomain<TOA>>>
Input Metric:
M
Output Metric:
M
- Parameters:
input_domain (Domain) –
input_metric (Metric) –
TOA (Type Argument) – Atomic Output Type to cast into
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_cast_default(input_domain, input_metric, TOA)[source]#
Make a Transformation that casts a vector of data from type
TIA
to typeTOA
. Any element that fails to cast is filled with default.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:
VectorDomain<AtomDomain<TOA>>
Input Metric:
M
Output Metric:
M
- Parameters:
input_domain (Domain) –
input_metric (Metric) –
TOA (Type Argument) – Atomic Output Type to cast into
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_cast_inherent(input_domain, input_metric, TOA)[source]#
Make a Transformation that casts a vector of data from type
TIA
to a type that can represent nullityTOA
. If cast fails, fill withTOA
’s null value.TIA
TIA::default()
float
NaN
Required features:
contrib
make_cast_inherent in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<TIA>>
Output Domain:
VectorDomain<AtomDomain<TOA>>
Input Metric:
M
Output Metric:
M
- Parameters:
input_domain (Domain) –
input_metric (Metric) –
TOA (Type Argument) – Atomic Output Type to cast into
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_cdf(TA='float')[source]#
Postprocess a noisy array of float summary counts into a cumulative distribution.
Required features:
contrib
make_cdf in Rust documentation.
Supporting Elements:
Input Type:
Vec<TA>
Output Type:
Vec<TA>
- Parameters:
TA (Type Argument) – Atomic Type. One of
f32
orf64
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_clamp(input_domain, input_metric, bounds)[source]#
Make a Transformation that clamps numeric data in
Vec<TA>
tobounds
.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:
VectorDomain<AtomDomain<TA>>
Input Metric:
M
Output Metric:
M
Proof Definition:
- Parameters:
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_consistent_b_ary_tree(branching_factor, TIA='int', TOA='float')[source]#
Postprocessor that makes a noisy b-ary tree internally consistent, and returns the leaf layer.
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>
- Parameters:
branching_factor (int) – the maximum number of children
TIA (Type Argument) – Atomic type of the input data. Should be an integer type.
TOA (Type Argument) – Atomic type of the output data. Should be a float type.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_count(input_domain, input_metric, TO='int')[source]#
Make a Transformation that computes a count of the number of records in data.
Required features:
contrib
make_count in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<TIA>>
Output Domain:
AtomDomain<TO>
Input Metric:
SymmetricDistance
Output Metric:
AbsoluteDistance<TO>
Proof Definition:
- Parameters:
input_domain (Domain) – Domain of the data type to be privatized.
input_metric (Metric) – Metric of the data type to be privatized.
TO (Type Argument) – Output Type. Must be numeric.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_count_by(input_domain, input_metric, MO, TV='int')[source]#
Make a Transformation that computes the count of each unique value in data. This assumes that the category set is unknown.
Required features:
contrib
make_count_by in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<TK>>
Output Domain:
MapDomain<AtomDomain<TK>, AtomDomain<TV>>
Input Metric:
SymmetricDistance
Output Metric:
MO
- Parameters:
input_domain (Domain) –
input_metric (Metric) –
MO (SensitivityMetric) – Output Metric.
TV (Type Argument) – Type of Value. Express counts in terms of this integral type.
- Returns:
The carrier type is
HashMap<TK, TV>
, a hashmap of the count (TV
) for each unique data input (TK
).- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_count_by_categories(input_domain, input_metric, categories, null_category=True, MO='L1Distance<int>', TOA='int')[source]#
Make a Transformation that computes the number of times each category appears in the data. This assumes that the category set is known.
Required features:
contrib
make_count_by_categories in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<TIA>>
Output Domain:
VectorDomain<AtomDomain<TOA>>
Input Metric:
SymmetricDistance
Output Metric:
MO
- Parameters:
input_domain (Domain) –
input_metric (Metric) –
categories – The set of categories to compute counts for.
null_category (bool) – Include a count of the number of elements that were not in the category set at the end of the vector.
MO (SensitivityMetric) – Output Metric.
TOA (Type Argument) – Atomic Output Type that is numeric.
- Returns:
The carrier type is
Vec<TOA>
, a vector of the counts (TOA
).- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_count_distinct(input_domain, input_metric, TO='int')[source]#
Make a Transformation that computes a count of the number of unique, distinct records in data.
Required features:
contrib
make_count_distinct in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<TIA>>
Output Domain:
AtomDomain<TO>
Input Metric:
SymmetricDistance
Output Metric:
AbsoluteDistance<TO>
- Parameters:
input_domain (Domain) –
input_metric (Metric) –
TO (Type Argument) – Output Type. Must be numeric.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_create_dataframe(col_names, K=None)[source]#
Make a Transformation that constructs a dataframe from a
Vec<Vec<String>>
(a vector of records).Required features:
contrib
make_create_dataframe in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<VectorDomain<AtomDomain<String>>>
Output Domain:
DataFrameDomain<K>
Input Metric:
SymmetricDistance
Output Metric:
SymmetricDistance
- Parameters:
col_names – Column names for each record entry.
K (Type Argument) – categorical/hashable data type of column names
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
Deprecated since version 0.12.0: Use Polars instead
- opendp.transformations.make_df_cast_default(input_domain, input_metric, column_name, TIA, TOA)[source]#
Make a Transformation that casts the elements in a column in a dataframe from type
TIA
to typeTOA
. If cast fails, fill with default.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:
DataFrameDomain<TK>
Input Metric:
M
Output Metric:
M
- Parameters:
input_domain (Domain) –
input_metric (Metric) –
column_name – column name to be transformed
TIA (Type Argument) – Atomic Input Type to cast from
TOA (Type Argument) – Atomic Output Type to cast into
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
Deprecated since version 0.12.0: Use Polars instead
- opendp.transformations.make_df_is_equal(input_domain, input_metric, column_name, value, TIA=None)[source]#
Make a Transformation that checks if each element in a column in a dataframe is equivalent to
value
.Required features:
contrib
make_df_is_equal in Rust documentation.
Supporting Elements:
Input Domain:
DataFrameDomain<TK>
Output Domain:
DataFrameDomain<TK>
Input Metric:
M
Output Metric:
M
- Parameters:
input_domain (Domain) –
input_metric (Metric) –
column_name – Column name to be transformed
value – Value to check for equality
TIA (Type Argument) – Atomic Input Type to cast from
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
Deprecated since version 0.12.0: Use Polars instead
- opendp.transformations.make_drop_null(input_domain, input_metric)[source]#
Make a Transformation that drops null values.
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:
VectorDomain<AtomDomain<DIA::Imputed>>
Input Metric:
M
Output Metric:
M
- Parameters:
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_find(input_domain, input_metric, categories)[source]#
Find the index of a data value in a set of categories.
For each value in the input vector, finds the index of the value in
categories
. If an index is found, returnsSome(index)
, elseNone
. Chain withmake_impute_constant
ormake_drop_null
to handle nullity.Required features:
contrib
make_find in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<TIA>>
Output Domain:
VectorDomain<OptionDomain<AtomDomain<usize>>>
Input Metric:
M
Output Metric:
M
- Parameters:
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_find_bin(input_domain, input_metric, edges)[source]#
Make a transformation that finds the bin index in a monotonically increasing vector of edges.
For each value in the input vector, finds the index of the bin the value falls into.
edges
splits the entire range ofTIA
into bins. The first bin at index zero ranges from negative infinity to the first edge, non-inclusive. The last bin at indexedges.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:
VectorDomain<AtomDomain<usize>>
Input Metric:
M
Output Metric:
M
- Parameters:
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_identity(domain, metric)[source]#
Make a Transformation representing the identity function.
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
andinput_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:
D
Input Metric:
M
Output Metric:
M
- Parameters:
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_impute_constant(input_domain, input_metric, constant)[source]#
Make a Transformation that replaces null/None data with
constant
.If chaining after a
make_cast
, the input type isOption<Vec<TA>>
. If chaining after amake_cast_inherent
, the input type isVec<TA>
, whereTA
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:
VectorDomain<AtomDomain<DIA::Imputed>>
Input Metric:
M
Output Metric:
M
- Parameters:
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_impute_uniform_float(input_domain, input_metric, bounds)[source]#
Make a Transformation that replaces NaN values in
Vec<TA>
with uniformly distributed floats withinbounds
.Required features:
contrib
make_impute_uniform_float in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<TA>>
Output Domain:
VectorDomain<AtomDomain<TA>>
Input Metric:
M
Output Metric:
M
- Parameters:
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_index(input_domain, input_metric, categories, null, TOA=None)[source]#
Make a transformation that treats each element as an index into a vector of categories.
Required features:
contrib
make_index in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<usize>>
Output Domain:
VectorDomain<AtomDomain<TOA>>
Input Metric:
M
Output Metric:
M
- Parameters:
input_domain (Domain) – The domain of the input vector.
input_metric (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 (Type Argument) – Atomic Output Type. Output data will be
Vec<TOA>
.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_is_equal(input_domain, input_metric, value)[source]#
Make a Transformation that checks if each element is equal to
value
.Required features:
contrib
make_is_equal in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<TIA>>
Output Domain:
VectorDomain<AtomDomain<bool>>
Input Metric:
M
Output Metric:
M
Proof Definition:
- Parameters:
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_is_null(input_domain, input_metric)[source]#
Make a Transformation that checks if each element in a vector is null.
Required features:
contrib
make_is_null in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<DIA>
Output Domain:
VectorDomain<AtomDomain<bool>>
Input Metric:
M
Output Metric:
M
- Parameters:
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_lipschitz_float_mul(constant, bounds, D='AtomDomain<T>', M='AbsoluteDistance<T>')[source]#
Make a transformation that multiplies an aggregate by a constant.
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:
D
Output Domain:
D
Input Metric:
M
Output Metric:
M
- Parameters:
constant – The constant to multiply aggregates by.
bounds (tuple[Any, Any]) – Tuple of inclusive lower and upper bounds.
D (Type Argument) – Domain of the function. Must be
AtomDomain<T>
orVectorDomain<AtomDomain<T>>
M (Type Argument) – Metric. Must be
AbsoluteDistance<T>
,L1Distance<T>
orL2Distance<T>
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_mean(input_domain, input_metric)[source]#
Make a Transformation that computes the mean of bounded data.
This uses a restricted-sensitivity proof that takes advantage of known dataset size. Use
make_clamp
to bound data andmake_resize
to establish dataset size.Required features:
contrib
make_mean in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<T>>
Output Domain:
AtomDomain<T>
Input Metric:
MI
Output Metric:
AbsoluteDistance<T>
- Parameters:
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_metric_bounded(input_domain, input_metric)[source]#
Make a Transformation that converts the unbounded dataset metric
MI
to the respective bounded dataset metric with a no-op.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:
D
Input Metric:
MI
Output Metric:
MI::BoundedMetric
- Parameters:
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_metric_unbounded(input_domain, input_metric)[source]#
Make a Transformation that converts the bounded dataset metric
MI
to the respective unbounded dataset metric with a no-op.MI
MI::UnboundedMetric
ChangeOneDistance
SymmetricDistance
HammingDistance
InsertDeleteDistance
Required features:
contrib
make_metric_unbounded in Rust documentation.
Supporting Elements:
Input Domain:
D
Output Domain:
D
Input Metric:
MI
Output Metric:
MI::UnboundedMetric
- Parameters:
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_ordered_random(input_domain, input_metric)[source]#
Make a Transformation that converts the unordered dataset metric
SymmetricDistance
to the respective ordered dataset metricInsertDeleteDistance
by assigning a random permutation.MI
MI::OrderedMetric
SymmetricDistance
InsertDeleteDistance
ChangeOneDistance
HammingDistance
Required features:
contrib
make_ordered_random in Rust documentation.
Supporting Elements:
Input Domain:
D
Output Domain:
D
Input Metric:
MI
Output Metric:
MI::OrderedMetric
- Parameters:
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_quantile_score_candidates(input_domain, input_metric, candidates, alpha)[source]#
Makes a Transformation that scores how similar each candidate is to the given
alpha
-quantile on the input dataset.Required features:
contrib
make_quantile_score_candidates in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<TIA>>
Output Domain:
VectorDomain<AtomDomain<usize>>
Input Metric:
MI
Output Metric:
LInfDistance<usize>
Proof Definition:
- Parameters:
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_quantiles_from_counts(bin_edges, alphas, interpolation='linear', TA=None, F='float')[source]#
Postprocess a noisy array of summary counts into quantiles.
Required features:
contrib
make_quantiles_from_counts in Rust documentation.
Supporting Elements:
Input Type:
Vec<TA>
Output Type:
Vec<TA>
- Parameters:
bin_edges – The edges that the input data was binned into before counting.
alphas – Return all specified
alpha
-quantiles.interpolation (str) – Must be one of
linear
ornearest
TA (Type Argument) – Atomic Type of the bin edges and data.
F (Type Argument) – Float type of the alpha argument. One of
f32
orf64
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_resize(input_domain, input_metric, size, constant, MO='SymmetricDistance')[source]#
Make a Transformation that either truncates or imputes records with
constant
to match a providedsize
.Required features:
contrib
make_resize in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<TA>>
Output Domain:
VectorDomain<AtomDomain<TA>>
Input Metric:
MI
Output Metric:
MO
- Parameters:
input_domain (Domain) – Domain of input data.
input_metric (Metric) – Metric of input data.
size (int) – Number of records in output data.
constant – Value to impute with.
MO (Type Argument) – Output Metric. One of
InsertDeleteDistance
orSymmetricDistance
- Returns:
A vector of the same type
TA
, but with the providedsize
.- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_select_column(key, TOA, K=None)[source]#
Make a Transformation that retrieves the column
key
from a dataframe asVec<TOA>
.Required features:
contrib
make_select_column in Rust documentation.
Supporting Elements:
Input Domain:
DataFrameDomain<K>
Output Domain:
VectorDomain<AtomDomain<TOA>>
Input Metric:
SymmetricDistance
Output Metric:
SymmetricDistance
- Parameters:
key – categorical/hashable data type of the key/column name
K (Type Argument) – data type of key
TOA (Type Argument) – Atomic Output Type to downcast vector to
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
Deprecated since version 0.12.0: Use Polars instead
- opendp.transformations.make_sized_bounded_float_checked_sum(size, bounds, S='Pairwise<T>')[source]#
Make a Transformation that computes the sum of bounded floats with known dataset size.
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, setS
toPairwise<f32>
.Required features:
contrib
make_sized_bounded_float_checked_sum in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<S::Item>>
Output Domain:
AtomDomain<S::Item>
Input Metric:
SymmetricDistance
Output Metric:
AbsoluteDistance<S::Item>
- Parameters:
size (int) – Number of records in input data.
bounds (tuple[Any, Any]) – Tuple of lower and upper bounds for data in the input domain.
S (Type Argument) – Summation algorithm to use over some data type
T
(T
is shorthand forS::Item
)
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_sized_bounded_float_ordered_sum(size, bounds, S='Pairwise<T>')[source]#
Make a Transformation that computes the sum of bounded floats with known ordering and dataset size.
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 usemake_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, setS
toPairwise<f32>
.Required features:
contrib
make_sized_bounded_float_ordered_sum in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<S::Item>>
Output Domain:
AtomDomain<S::Item>
Input Metric:
InsertDeleteDistance
Output Metric:
AbsoluteDistance<S::Item>
- Parameters:
size (int) – Number of records in input data.
bounds (tuple[Any, Any]) – Tuple of lower and upper bounds for data in the input domain.
S (Type Argument) – Summation algorithm to use over some data type
T
(T
is shorthand forS::Item
)
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_sized_bounded_int_checked_sum(size, bounds, T=None)[source]#
Make a Transformation that computes the sum of bounded ints. The effective range is reduced, as (bounds * size) must not overflow.
Required features:
contrib
make_sized_bounded_int_checked_sum in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<T>>
Output Domain:
AtomDomain<T>
Input Metric:
SymmetricDistance
Output Metric:
AbsoluteDistance<T>
- Parameters:
size (int) – Number of records in input data.
bounds (tuple[Any, Any]) – Tuple of lower and upper bounds for data in the input domain.
T (Type Argument) – Atomic Input Type and Output Type
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_sized_bounded_int_monotonic_sum(size, bounds, T=None)[source]#
Make a Transformation that computes the sum of bounded ints, where all values share the same sign.
Required features:
contrib
make_sized_bounded_int_monotonic_sum in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<T>>
Output Domain:
AtomDomain<T>
Input Metric:
SymmetricDistance
Output Metric:
AbsoluteDistance<T>
- Parameters:
size (int) – Number of records in input data.
bounds (tuple[Any, Any]) – Tuple of lower and upper bounds for data in the input domain.
T (Type Argument) – Atomic Input Type and Output Type
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_sized_bounded_int_ordered_sum(size, bounds, T=None)[source]#
Make a Transformation that computes the sum of bounded ints with known dataset size.
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:
AtomDomain<T>
Input Metric:
InsertDeleteDistance
Output Metric:
AbsoluteDistance<T>
- Parameters:
size (int) – Number of records in input data.
bounds (tuple[Any, Any]) – Tuple of lower and upper bounds for data in the input domain.
T (Type Argument) – Atomic Input Type and Output Type
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_sized_bounded_int_split_sum(size, bounds, T=None)[source]#
Make a Transformation that computes the sum of bounded ints with known dataset size.
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:
AtomDomain<T>
Input Metric:
SymmetricDistance
Output Metric:
AbsoluteDistance<T>
- Parameters:
size (int) – Number of records in input data.
bounds (tuple[Any, Any]) – Tuple of lower and upper bounds for data in the input domain.
T (Type Argument) – Atomic Input Type and Output Type
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_split_dataframe(separator, col_names, K=None)[source]#
Make a Transformation that splits each record in a String into a
Vec<Vec<String>>
, and loads the resulting table into a dataframe keyed bycol_names
.Required features:
contrib
make_split_dataframe in Rust documentation.
Supporting Elements:
Input Domain:
AtomDomain<String>
Output Domain:
DataFrameDomain<K>
Input Metric:
SymmetricDistance
Output Metric:
SymmetricDistance
- Parameters:
separator (str) – The token(s) that separate entries in each record.
col_names – Column names for each record entry.
K (Type Argument) – categorical/hashable data type of column names
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
Deprecated since version 0.12.0: Use Polars instead
- opendp.transformations.make_split_lines()[source]#
Make a Transformation that takes a string and splits it into a
Vec<String>
of its lines.Required features:
contrib
make_split_lines in Rust documentation.
Supporting Elements:
Input Domain:
AtomDomain<String>
Output Domain:
VectorDomain<AtomDomain<String>>
Input Metric:
SymmetricDistance
Output Metric:
SymmetricDistance
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_split_records(separator)[source]#
Make a Transformation that splits each record in a
Vec<String>
into aVec<Vec<String>>
.Required features:
contrib
make_split_records in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<String>>
Output Domain:
VectorDomain<VectorDomain<AtomDomain<String>>>
Input Metric:
SymmetricDistance
Output Metric:
SymmetricDistance
- Parameters:
separator (str) – The token(s) that separate entries in each record.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_stable_expr(input_domain, input_metric, expr)[source]#
Create a stable transformation from an [
Expr
].Required features:
contrib
make_stable_expr in Rust documentation.
Supporting Elements:
Input Domain:
ExprDomain
Output Domain:
ExprDomain
Input Metric:
MI
Output Metric:
MO
- Parameters:
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_stable_lazyframe(input_domain, input_metric, lazyframe)[source]#
Create a stable transformation from a [
LazyFrame
].Required features:
contrib
make_stable_lazyframe in Rust documentation.
Supporting Elements:
Input Domain:
LazyFrameDomain
Output Domain:
LazyFrameDomain
Input Metric:
MI
Output Metric:
MO
- Parameters:
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_subset_by(indicator_column, keep_columns, TK=None)[source]#
Make a Transformation that subsets a dataframe by a boolean column.
Required features:
contrib
make_subset_by in Rust documentation.
Supporting Elements:
Input Domain:
DataFrameDomain<TK>
Output Domain:
DataFrameDomain<TK>
Input Metric:
SymmetricDistance
Output Metric:
SymmetricDistance
- Parameters:
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 Argument) – Type of the column name
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
Deprecated since version 0.12.0: Use Polars instead
- opendp.transformations.make_sum(input_domain, input_metric)[source]#
Make a Transformation that computes the sum of bounded data. Use
make_clamp
to bound data.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:
AtomDomain<T>
Input Metric:
MI
Output Metric:
AbsoluteDistance<T>
- Parameters:
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_sum_of_squared_deviations(input_domain, input_metric, S='Pairwise<T>')[source]#
Make a Transformation that computes the sum of squared deviations of bounded data.
This uses a restricted-sensitivity proof that takes advantage of known dataset size. Use
make_clamp
to bound data andmake_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, setS
toPairwise<f32>
.Required features:
contrib
make_sum_of_squared_deviations in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<S::Item>>
Output Domain:
AtomDomain<S::Item>
Input Metric:
SymmetricDistance
Output Metric:
AbsoluteDistance<S::Item>
- Parameters:
input_domain (Domain) –
input_metric (Metric) –
S (Type Argument) – Summation algorithm to use on data type
T
. One ofSequential<T>
orPairwise<T>
.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_unordered(input_domain, input_metric)[source]#
Make a Transformation that converts the ordered dataset metric
MI
to the respective ordered dataset metric with a no-op.MI
MI::UnorderedMetric
InsertDeleteDistance
SymmetricDistance
HammingDistance
ChangeOneDistance
Required features:
contrib
make_unordered in Rust documentation.
Supporting Elements:
Input Domain:
D
Output Domain:
D
Input Metric:
MI
Output Metric:
MI::UnorderedMetric
- Parameters:
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_user_transformation(input_domain, input_metric, output_domain, output_metric, function, stability_map)[source]#
Construct a Transformation from user-defined callbacks.
Required features:
contrib
,honest-but-curious
Why honest-but-curious?:
This constructor only returns a valid transformation if for every pair of elements \(x, x'\) in
input_domain
, and for every pair(d_in, d_out)
, whered_in
has the associated type forinput_metric
andd_out
has the associated type foroutput_metric
, if \(x, x'\) ared_in
-close underinput_metric
,stability_map(d_in)
does not raise an exception, andstability_map(d_in) <= d_out
, thenfunction(x), function(x')
are d_out-close underoutput_metric
.In addition, for every element \(x\) in
input_domain
,function(x)
is a member ofoutput_domain
or raises a data-independent runtime exception.In addition,
function
must not have side-effects, andstability_map
must be a pure function.- Parameters:
input_domain (Domain) – A domain describing the set of valid inputs for the function.
input_metric (Metric) – The metric from which distances between adjacent inputs are measured.
output_domain (Domain) – A domain describing the set of valid outputs of the function.
output_metric (Metric) – The metric from which distances between outputs of adjacent inputs are measured.
function – A function mapping data from
input_domain
tooutput_domain
.stability_map – A function mapping distances from
input_metric
tooutput_metric
.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_variance(input_domain, input_metric, ddof=1, S='Pairwise<T>')[source]#
Make a Transformation that computes the variance of bounded data.
This uses a restricted-sensitivity proof that takes advantage of known dataset size. Use
make_clamp
to bound data andmake_resize
to establish dataset size.Required features:
contrib
make_variance in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<AtomDomain<S::Item>>
Output Domain:
AtomDomain<S::Item>
Input Metric:
SymmetricDistance
Output Metric:
AbsoluteDistance<S::Item>
- Parameters:
input_domain (Domain) –
input_metric (Metric) –
ddof (int) – Delta degrees of freedom. Set to 0 if not a sample, 1 for sample estimate.
S (Type Argument) – Summation algorithm to use on data type
T
. One ofSequential<T>
orPairwise<T>
.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.then_b_ary_tree(leaf_count, branching_factor)[source]#
partial constructor of make_b_ary_tree
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_b_ary_tree()
- Parameters:
leaf_count (int) – The number of leaf nodes in the b-ary tree.
branching_factor (int) – The number of children on each branch of the resulting tree. Larger branching factors result in shallower trees.
- opendp.transformations.then_cast(TOA)[source]#
partial constructor of make_cast
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_cast()
- Parameters:
TOA (Type Argument) – Atomic Output Type to cast into
- opendp.transformations.then_cast_default(TOA)[source]#
partial constructor of make_cast_default
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_cast_default()
- Parameters:
TOA (Type Argument) – Atomic Output Type to cast into
- opendp.transformations.then_cast_inherent(TOA)[source]#
partial constructor of make_cast_inherent
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_cast_inherent()
- Parameters:
TOA (Type Argument) – Atomic Output Type to cast into
- opendp.transformations.then_clamp(bounds)[source]#
partial constructor of make_clamp
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_clamp()
- Parameters:
bounds (tuple[Any, Any]) – Tuple of inclusive lower and upper bounds.
- opendp.transformations.then_count(TO='int')[source]#
partial constructor of make_count
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_count()
- Parameters:
TO (Type Argument) – Output Type. Must be numeric.
- opendp.transformations.then_count_by(MO, TV='int')[source]#
partial constructor of make_count_by
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_count_by()
- Parameters:
MO (SensitivityMetric) – Output Metric.
TV (Type Argument) – Type of Value. Express counts in terms of this integral type.
- opendp.transformations.then_count_by_categories(categories, null_category=True, MO='L1Distance<int>', TOA='int')[source]#
partial constructor of make_count_by_categories
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_count_by_categories()
- Parameters:
categories – The set of categories to compute counts for.
null_category (bool) – Include a count of the number of elements that were not in the category set at the end of the vector.
MO (SensitivityMetric) – Output Metric.
TOA (Type Argument) – Atomic Output Type that is numeric.
- opendp.transformations.then_count_distinct(TO='int')[source]#
partial constructor of make_count_distinct
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_count_distinct()
- Parameters:
TO (Type Argument) – Output Type. Must be numeric.
- opendp.transformations.then_df_cast_default(column_name, TIA, TOA)[source]#
partial constructor of make_df_cast_default
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_df_cast_default()
- Parameters:
column_name – column name to be transformed
TIA (Type Argument) – Atomic Input Type to cast from
TOA (Type Argument) – Atomic Output Type to cast into
- opendp.transformations.then_df_is_equal(column_name, value, TIA=None)[source]#
partial constructor of make_df_is_equal
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_df_is_equal()
- Parameters:
column_name – Column name to be transformed
value – Value to check for equality
TIA (Type Argument) – Atomic Input Type to cast from
- opendp.transformations.then_drop_null()[source]#
partial constructor of make_drop_null
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_drop_null()
- opendp.transformations.then_find(categories)[source]#
partial constructor of make_find
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_find()
- Parameters:
categories – The set of categories to find indexes from.
- opendp.transformations.then_find_bin(edges)[source]#
partial constructor of make_find_bin
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_find_bin()
- Parameters:
edges – The set of edges to split bins by.
- opendp.transformations.then_identity()[source]#
partial constructor of make_identity
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_identity()
- opendp.transformations.then_impute_constant(constant)[source]#
partial constructor of make_impute_constant
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_impute_constant()
- Parameters:
constant – Value to replace nulls with.
- opendp.transformations.then_impute_uniform_float(bounds)[source]#
partial constructor of make_impute_uniform_float
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_impute_uniform_float()
- Parameters:
bounds (tuple[Any, Any]) – Tuple of inclusive lower and upper bounds.
- opendp.transformations.then_index(categories, null, TOA=None)[source]#
partial constructor of make_index
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_index()
- Parameters:
categories – The set of categories to index into.
null – Category to return if the index is out-of-range of the category set.
TOA (Type Argument) – Atomic Output Type. Output data will be
Vec<TOA>
.
- opendp.transformations.then_is_equal(value)[source]#
partial constructor of make_is_equal
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_is_equal()
- Parameters:
value – value to check against
- opendp.transformations.then_is_null()[source]#
partial constructor of make_is_null
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_is_null()
- opendp.transformations.then_mean()[source]#
partial constructor of make_mean
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_mean()
- opendp.transformations.then_metric_bounded()[source]#
partial constructor of make_metric_bounded
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_metric_bounded()
- opendp.transformations.then_metric_unbounded()[source]#
partial constructor of make_metric_unbounded
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_metric_unbounded()
- opendp.transformations.then_ordered_random()[source]#
partial constructor of make_ordered_random
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_ordered_random()
- opendp.transformations.then_quantile_score_candidates(candidates, alpha)[source]#
partial constructor of make_quantile_score_candidates
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_quantile_score_candidates()
- Parameters:
candidates – Potential quantiles to score
alpha (float) – a value in $[0, 1]$. Choose 0.5 for median
- opendp.transformations.then_resize(size, constant, MO='SymmetricDistance')[source]#
partial constructor of make_resize
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_resize()
- Parameters:
size (int) – Number of records in output data.
constant – Value to impute with.
MO (Type Argument) – Output Metric. One of
InsertDeleteDistance
orSymmetricDistance
- opendp.transformations.then_stable_expr(expr)[source]#
partial constructor of make_stable_expr
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_stable_expr()
- Parameters:
expr – The expression to be analyzed for stability.
- opendp.transformations.then_stable_lazyframe(lazyframe)[source]#
partial constructor of make_stable_lazyframe
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_stable_lazyframe()
- Parameters:
lazyframe – The [
LazyFrame
] to be analyzed.
- opendp.transformations.then_sum()[source]#
partial constructor of make_sum
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_sum()
- opendp.transformations.then_sum_of_squared_deviations(S='Pairwise<T>')[source]#
partial constructor of make_sum_of_squared_deviations
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_sum_of_squared_deviations()
- Parameters:
S (Type Argument) – Summation algorithm to use on data type
T
. One ofSequential<T>
orPairwise<T>
.
- opendp.transformations.then_unordered()[source]#
partial constructor of make_unordered
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_unordered()
- opendp.transformations.then_variance(ddof=1, S='Pairwise<T>')[source]#
partial constructor of make_variance
See also
Delays application of
input_domain
andinput_metric
inopendp.transformations.make_variance()
- Parameters:
ddof (int) – Delta degrees of freedom. Set to 0 if not a sample, 1 for sample estimate.
S (Type Argument) – Summation algorithm to use on data type
T
. One ofSequential<T>
orPairwise<T>
.