opendp.transformations module#
- 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.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
UnknownTypeError – if a type argument fails to parse
- opendp.transformations.make_b_ary_tree(leaf_count, branching_factor, M, TA='int')[source]#
Expand a vector of counts into a b-ary tree of counts, where each branch is the sum of its
b
immediate children.make_b_ary_tree in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AllDomain<TA>>
Output Domain:
VectorDomain<AllDomain<TA>>
Input Metric:
M
Output Metric:
M
- 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.
M (Type Argument) – Metric. Must be
L1Distance<Q>
orL2Distance<Q>
TA (Type Argument) – Atomic Type of the input data.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – 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_bounded_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>
.make_bounded_float_checked_sum in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<BoundedDomain<S::Item>>
Output Domain:
AllDomain<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
UnknownTypeError – 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>
.make_bounded_float_ordered_sum in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<BoundedDomain<S::Item>>
Output Domain:
AllDomain<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
UnknownTypeError – 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.
make_bounded_int_monotonic_sum in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<BoundedDomain<T>>
Output Domain:
AllDomain<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
UnknownTypeError – 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.make_bounded_int_ordered_sum in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<BoundedDomain<T>>
Output Domain:
AllDomain<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
UnknownTypeError – 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.
make_bounded_int_split_sum in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<BoundedDomain<T>>
Output Domain:
AllDomain<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
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_bounded_resize(size, bounds, constant, MI='SymmetricDistance', MO='SymmetricDistance', TA=None)[source]#
Make a Transformation that either truncates or imputes records with
constant
in aVec<TA>
to match a providedsize
.make_bounded_resize in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<BoundedDomain<TA>>
Output Domain:
SizedDomain<VectorDomain<BoundedDomain<TA>>>
Input Metric:
MI
Output Metric:
MO
- Parameters:
size (int) – Number of records in output data.
bounds (Tuple[Any, Any]) – Tuple of lower and upper bounds for data in the input domain.
constant – Value to impute with.
MI (Type Argument) – Input Metric. One of
InsertDeleteDistance
orSymmetricDistance
MO (Type Argument) – Output Metric. One of
InsertDeleteDistance
orSymmetricDistance
TA (Type Argument) – Atomic type. If not passed,
TA
is inferred from the lower bound
- 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
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_bounded_sum(bounds, MI='SymmetricDistance', T=None)[source]#
Make a Transformation that computes the sum of bounded data. Use
make_clamp
to bound data.make_bounded_sum in Rust documentation.
Citations:
- Parameters:
bounds (Tuple[Any, Any]) – Tuple of lower and upper bounds for data in the input domain.
MI (Type Argument) – Input Metric. One of
SymmetricDistance
orInsertDeleteDistance
.T (Type Argument) – Atomic Input Type and Output Type.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_cast(TIA, 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.make_cast in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AllDomain<TIA>>
Output Domain:
VectorDomain<OptionNullDomain<AllDomain<TOA>>>
Input Metric:
SymmetricDistance
Output Metric:
SymmetricDistance
- Parameters:
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
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_cast_default(TIA, 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
make_cast_default in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AllDomain<TIA>>
Output Domain:
VectorDomain<AllDomain<TOA>>
Input Metric:
SymmetricDistance
Output Metric:
SymmetricDistance
- Parameters:
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
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_cast_inherent(TIA, 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
make_cast_inherent in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AllDomain<TIA>>
Output Domain:
VectorDomain<InherentNullDomain<AllDomain<TOA>>>
Input Metric:
SymmetricDistance
Output Metric:
SymmetricDistance
- Parameters:
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
UnknownTypeError – 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.
make_cdf in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AllDomain<TA>>
Output Domain:
VectorDomain<AllDomain<TA>>
Input Metric:
AgnosticMetric
Output Metric:
AgnosticMetric
- Parameters:
TA (Type Argument) – Atomic Type. One of
f32
orf64
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_clamp(bounds, TA=None)[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.
make_clamp in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AllDomain<TA>>
Output Domain:
VectorDomain<BoundedDomain<TA>>
Input Metric:
SymmetricDistance
Output Metric:
SymmetricDistance
- Parameters:
bounds (Tuple[Any, Any]) – Tuple of inclusive lower and upper bounds.
TA (Type Argument) – Atomic Type
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – 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]#
Postprocessing transformation 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.
make_consistent_b_ary_tree in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<AllDomain<TIA>>
Output Domain:
VectorDomain<AllDomain<TOA>>
Input Metric:
AgnosticMetric
Output Metric:
AgnosticMetric
- 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
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_count(TIA, TO='int')[source]#
Make a Transformation that computes a count of the number of records in data.
make_count in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<AllDomain<TIA>>
Output Domain:
AllDomain<TO>
Input Metric:
SymmetricDistance
Output Metric:
AbsoluteDistance<TO>
Proof Definition:
- Parameters:
TIA (Type Argument) – Atomic Input Type. Input data is expected to be of the form
Vec<TIA>
.TO (Type Argument) – Output Type. Must be numeric.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_count_by(MO, TK, TV='int')[source]#
Make a Transformation that computes the count of each unique value in data. This assumes that the category set is unknown.
make_count_by in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<AllDomain<TK>>
Output Domain:
MapDomain<AllDomain<TK>, AllDomain<TV>>
Input Metric:
SymmetricDistance
Output Metric:
MO
- Parameters:
MO (SensitivityMetric) – Output Metric.
TK (Type Argument) – Type of Key. Categorical/hashable input data type. Input data must be
Vec<TK>
.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
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_count_by_categories(categories, null_category=True, MO='L1Distance<int>', TIA=None, 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.
make_count_by_categories in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<AllDomain<TIA>>
Output Domain:
VectorDomain<AllDomain<TOA>>
Input Metric:
SymmetricDistance
Output Metric:
MO
- Parameters:
categories (Any) – 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.
TIA (Type Argument) – Atomic Input Type that is categorical/hashable. Input data must be
Vec<TIA>
TOA (Type Argument) – Atomic Output Type that is numeric.
- 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
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_count_distinct(TIA, TO='int')[source]#
Make a Transformation that computes a count of the number of unique, distinct records in data.
make_count_distinct in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
VectorDomain<AllDomain<TIA>>
Output Domain:
AllDomain<TO>
Input Metric:
SymmetricDistance
Output Metric:
AbsoluteDistance<TO>
- Parameters:
TIA (Type Argument) – Atomic Input Type. Input data is expected to be of the form Vec<TIA>.
TO (Type Argument) – Output Type. Must be numeric.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – 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).make_create_dataframe in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<VectorDomain<AllDomain<String>>>
Output Domain:
DataFrameDomain<K>
Input Metric:
SymmetricDistance
Output Metric:
SymmetricDistance
- Parameters:
col_names (Any) – 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
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_df_cast_default(column_name, TIA, TOA, TK=None)[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
make_df_cast_default in Rust documentation.
Supporting Elements:
Input Domain:
DataFrameDomain<TK>
Output Domain:
DataFrameDomain<TK>
Input Metric:
SymmetricDistance
Output Metric:
SymmetricDistance
- Parameters:
column_name (Any) – column name to be transformed
TK (Type Argument) – Type of the column name
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
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_df_is_equal(column_name, value, TK=None, TIA=None)[source]#
Make a Transformation that checks if each element in a column in a dataframe is equivalent to
value
.make_df_is_equal in Rust documentation.
Supporting Elements:
Input Domain:
DataFrameDomain<TK>
Output Domain:
DataFrameDomain<TK>
Input Metric:
SymmetricDistance
Output Metric:
SymmetricDistance
- Parameters:
column_name (Any) – Column name to be transformed
value (Any) – Value to check for equality
TK (Type Argument) – Type of the column name
TIA (Type Argument) – Atomic Input Type to cast from
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_drop_null(DA)[source]#
Make a Transformation that drops null values.
DA
DA::Imputed
OptionNullDomain<AllDomain<TA>>
TA
InherentNullDomain<AllDomain<TA>>
TA
make_drop_null in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<DA>
Output Domain:
VectorDomain<AllDomain<DA::Imputed>>
Input Metric:
SymmetricDistance
Output Metric:
SymmetricDistance
- Parameters:
DA (Type Argument) – atomic domain of input data that contains nulls.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_find(categories, TIA=None)[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.make_find in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AllDomain<TIA>>
Output Domain:
VectorDomain<OptionNullDomain<AllDomain<usize>>>
Input Metric:
SymmetricDistance
Output Metric:
SymmetricDistance
- Parameters:
categories (Any) – The set of categories to find indexes from.
TIA (Type Argument) – Atomic Input Type that is categorical/hashable
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_find_bin(edges, TIA=None)[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.make_find_bin in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AllDomain<TIA>>
Output Domain:
VectorDomain<AllDomain<usize>>
Input Metric:
SymmetricDistance
Output Metric:
SymmetricDistance
- Parameters:
edges (Any) – The set of edges to split bins by.
TIA (Type Argument) – Atomic Input Type that is numeric
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_identity(D, M)[source]#
Make a Transformation representing the identity function.
make_identity in Rust documentation.
Supporting Elements:
Input Domain:
D
Output Domain:
D
Input Metric:
M
Output Metric:
M
- Parameters:
D (Type Argument) – Domain of the identity function. Must be
VectorDomain<AllDomain<T>>
orAllDomain<T>
M (Type Argument) – Metric. Must be a dataset metric if D is a VectorDomain or a sensitivity metric if D is an AllDomain
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_impute_constant(constant, DIA='OptionNullDomain<AllDomain<TA>>')[source]#
Make a Transformation that replaces null/None data with
constant
.By default, the input type is
Vec<Option<TA>>
, as emitted by make_cast. SetDA
toInherentNullDomain<AllDomain<TA>>
for imputing on types that have an inherent representation of nullity, like floats.Atom Input Domain
DIA
Input Type
DIA::Imputed
OptionNullDomain<AllDomain<TA>>
Vec<Option<TA>>
TA
InherentNullDomain<AllDomain<TA>>
Vec<TA>
TA
make_impute_constant in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<DIA>
Output Domain:
VectorDomain<AllDomain<DIA::Imputed>>
Input Metric:
SymmetricDistance
Output Metric:
SymmetricDistance
- Parameters:
constant (Any) – Value to replace nulls with.
DIA (Type Argument) – Atomic Input Domain of data being imputed.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_impute_uniform_float(bounds, TA=None)[source]#
Make a Transformation that replaces NaN values in
Vec<TA>
with uniformly distributed floats withinbounds
.make_impute_uniform_float in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<InherentNullDomain<AllDomain<TA>>>
Output Domain:
VectorDomain<AllDomain<TA>>
Input Metric:
SymmetricDistance
Output Metric:
SymmetricDistance
- Parameters:
bounds (Tuple[Any, Any]) – Tuple of inclusive lower and upper bounds.
TA (Type Argument) – Atomic Type of data being imputed. One of
f32
orf64
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_index(categories, null, TOA=None)[source]#
Make a transformation that treats each element as an index into a vector of categories.
make_index in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AllDomain<usize>>
Output Domain:
VectorDomain<AllDomain<TOA>>
Input Metric:
SymmetricDistance
Output Metric:
SymmetricDistance
- Parameters:
categories (Any) – The set of categories to index into.
null (Any) – 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
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_is_equal(value, TIA=None)[source]#
Make a Transformation that checks if each element is equal to
value
.make_is_equal in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AllDomain<TIA>>
Output Domain:
VectorDomain<AllDomain<bool>>
Input Metric:
SymmetricDistance
Output Metric:
SymmetricDistance
- Parameters:
value (Any) – value to check against
TIA (Type Argument) – Atomic Input Type. Type of elements in the input vector
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_is_null(DIA)[source]#
Make a Transformation that checks if each element in a vector is null.
make_is_null in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<DIA>
Output Domain:
VectorDomain<AllDomain<bool>>
Input Metric:
SymmetricDistance
Output Metric:
SymmetricDistance
- Parameters:
DIA (Type Argument) – Atomic Input Domain. Can be any domain for which the carrier type has a notion of nullity.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_lipschitz_float_mul(constant, bounds, D='AllDomain<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.
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
AllDomain<T>
orVectorDomain<AllDomain<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
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_metric_bounded(size, TA, MI='SymmetricDistance')[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.
While it is valid to operate with bounded data, there is no constructor for it in Python.
MI
MI::BoundedMetric
SymmetricDistance
ChangeOneDistance
InsertDeleteDistance
HammingDistance
make_metric_bounded in Rust documentation.
Supporting Elements:
Input Domain:
SizedDomain<VectorDomain<AllDomain<TA>>>
Output Domain:
SizedDomain<VectorDomain<AllDomain<TA>>>
Input Metric:
MI
Output Metric:
MI::BoundedMetric
- Parameters:
size (int) – Number of records in input data.
MI (DatasetMetric) – Input Metric.
TA (Type Argument) – Atomic Type.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_metric_unbounded(size, TA, MI='ChangeOneDistance')[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
make_metric_unbounded in Rust documentation.
Supporting Elements:
Input Domain:
SizedDomain<VectorDomain<AllDomain<TA>>>
Output Domain:
SizedDomain<VectorDomain<AllDomain<TA>>>
Input Metric:
MI
Output Metric:
MI::UnboundedMetric
- Parameters:
size (int) – Number of records in input data.
MI (DatasetMetric) – Input Metric.
TA (Type Argument) – Atomic Type.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_ordered_random(TA)[source]#
Make a Transformation that converts the unordered dataset metric
SymmetricDistance
to the respective ordered dataset metricInsertDeleteDistance
by assigning a random permutation.The input metric is not generic because the only other dataset metric
ChangeOneDistance
is not valid due to the dataset size being unknown.make_ordered_random in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AllDomain<TA>>
Output Domain:
VectorDomain<AllDomain<TA>>
Input Metric:
SymmetricDistance
Output Metric:
InsertDeleteDistance
- Parameters:
TA (Type Argument) – Atomic Type.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – 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.
make_quantiles_from_counts in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AllDomain<TA>>
Output Domain:
VectorDomain<AllDomain<TA>>
Input Metric:
AgnosticMetric
Output Metric:
AgnosticMetric
- Parameters:
bin_edges (Any) – The edges that the input data was binned into before counting.
alphas (Any) – 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
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_resize(size, constant, MI='SymmetricDistance', MO='SymmetricDistance', TA=None)[source]#
Make a Transformation that either truncates or imputes records with
constant
in aVec<TA>
to match a providedsize
.make_resize in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AllDomain<TA>>
Output Domain:
SizedDomain<VectorDomain<AllDomain<TA>>>
Input Metric:
MI
Output Metric:
MO
- Parameters:
size (int) – Number of records in output data.
constant (Any) – Value to impute with.
MI (Type Argument) – Input Metric. One of
InsertDeleteDistance
orSymmetricDistance
MO (Type Argument) – Output Metric. One of
InsertDeleteDistance
orSymmetricDistance
TA (Type Argument) – Atomic type. If not passed,
TA
is inferred from the lower bound
- 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
UnknownTypeError – 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>
.make_select_column in Rust documentation.
Supporting Elements:
Input Domain:
DataFrameDomain<K>
Output Domain:
VectorDomain<AllDomain<TOA>>
Input Metric:
SymmetricDistance
Output Metric:
SymmetricDistance
- Parameters:
key (Any) – 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
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- 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>
.make_sized_bounded_float_checked_sum in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
SizedDomain<VectorDomain<BoundedDomain<S::Item>>>
Output Domain:
AllDomain<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
UnknownTypeError – 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>
.make_sized_bounded_float_ordered_sum in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
SizedDomain<VectorDomain<BoundedDomain<S::Item>>>
Output Domain:
AllDomain<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
UnknownTypeError – 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.
make_sized_bounded_int_checked_sum in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
SizedDomain<VectorDomain<BoundedDomain<T>>>
Output Domain:
AllDomain<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
UnknownTypeError – 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.
make_sized_bounded_int_monotonic_sum in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
SizedDomain<VectorDomain<BoundedDomain<T>>>
Output Domain:
AllDomain<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
UnknownTypeError – 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.make_sized_bounded_int_ordered_sum in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
SizedDomain<VectorDomain<BoundedDomain<T>>>
Output Domain:
AllDomain<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
UnknownTypeError – 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.
make_sized_bounded_int_split_sum in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
SizedDomain<VectorDomain<BoundedDomain<T>>>
Output Domain:
AllDomain<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
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_sized_bounded_mean(size, bounds, MI='SymmetricDistance', T=None)[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_bounded_resize
to establish dataset size.make_sized_bounded_mean in Rust documentation.
Supporting Elements:
Input Domain:
SizedDomain<VectorDomain<BoundedDomain<T>>>
Output Domain:
AllDomain<T>
Input Metric:
MI
Output Metric:
AbsoluteDistance<T>
- Parameters:
size (int) – Number of records in input data.
bounds (Tuple[Any, Any]) – Tuple of inclusive lower and upper bounds.
MI (Type Argument) – Input Metric. One of
SymmetricDistance
orInsertDeleteDistance
T (Type Argument) – Atomic Input Type and Output Type.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_sized_bounded_ordered_random(size, bounds, TA, MI='SymmetricDistance')[source]#
Make a Transformation that converts the unordered dataset metric
MI
to the respective ordered dataset metric by assigning a random permutation.MI
MI::OrderedMetric
SymmetricDistance
InsertDeleteDistance
ChangeOneDistance
HammingDistance
make_sized_bounded_ordered_random in Rust documentation.
Supporting Elements:
Input Domain:
SizedDomain<VectorDomain<BoundedDomain<TA>>>
Output Domain:
SizedDomain<VectorDomain<BoundedDomain<TA>>>
Input Metric:
MI
Output Metric:
MI::OrderedMetric
- Parameters:
size (int) – Number of records in input data.
bounds (Tuple[Any, Any]) – Tuple of inclusive lower and upper bounds.
MI (DatasetMetric) – Input Metric.
TA (Type Argument) – Atomic Type.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_sized_bounded_sum(size, bounds, MI='SymmetricDistance', T=None)[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_bounded_resize
to establish dataset size.make_sized_bounded_sum in Rust documentation.
Citations:
- 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.
MI (Type Argument) – Input Metric. One of
SymmetricDistance
orInsertDeleteDistance
.T (Type Argument) – Atomic Input Type and Output Type.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_sized_bounded_sum_of_squared_deviations(size, bounds, 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_bounded_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>
.make_sized_bounded_sum_of_squared_deviations in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
SizedDomain<VectorDomain<BoundedDomain<S::Item>>>
Output Domain:
AllDomain<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 on data type
T
. One ofSequential<T>
orPairwise<T>
.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_sized_bounded_unordered(size, bounds, TA, MI='InsertDeleteDistance')[source]#
Make a Transformation that converts the ordered dataset metric
MI
to the respective unordered dataset metric via a no-op.MI
MI::UnorderedMetric
InsertDeleteDistance
SymmetricDistance
HammingDistance
ChangeOneDistance
make_sized_bounded_unordered in Rust documentation.
Supporting Elements:
Input Domain:
SizedDomain<VectorDomain<BoundedDomain<TA>>>
Output Domain:
SizedDomain<VectorDomain<BoundedDomain<TA>>>
Input Metric:
MI
Output Metric:
MI::UnorderedMetric
- Parameters:
size (int) – Number of records in input data.
bounds (Tuple[Any, Any]) – Tuple of inclusive lower and upper bounds.
MI (DatasetMetric) – Input Metric.
TA (Type Argument) – Atomic Type.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_sized_bounded_variance(size, bounds, 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_bounded_resize
to establish dataset size.make_sized_bounded_variance in Rust documentation.
Citations:
Supporting Elements:
Input Domain:
SizedDomain<VectorDomain<BoundedDomain<S::Item>>>
Output Domain:
AllDomain<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.
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
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_sized_ordered_random(size, TA, MI='SymmetricDistance')[source]#
Make a Transformation that converts the unordered dataset metric
MI
to the respective ordered dataset metric by assigning a random permutation.MI
MI::OrderedMetric
SymmetricDistance
InsertDeleteDistance
ChangeOneDistance
HammingDistance
make_sized_ordered_random in Rust documentation.
Supporting Elements:
Input Domain:
SizedDomain<VectorDomain<AllDomain<TA>>>
Output Domain:
SizedDomain<VectorDomain<AllDomain<TA>>>
Input Metric:
MI
Output Metric:
MI::OrderedMetric
- Parameters:
size (int) – Number of records in input data.
MI (DatasetMetric) – Input Metric.
TA (Type Argument) – Atomic Type.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_sized_unordered(size, TA, MI='InsertDeleteDistance')[source]#
Make a Transformation that converts the ordered dataset metric
MI
to the respective unordered dataset metric via a no-op.MI
MI::OrderedMetric
InsertDeleteDistance
SymmetricDistance
HammingDistance
ChangeOneDistance
make_sized_unordered in Rust documentation.
Supporting Elements:
Input Domain:
SizedDomain<VectorDomain<AllDomain<TA>>>
Output Domain:
SizedDomain<VectorDomain<AllDomain<TA>>>
Input Metric:
MI
Output Metric:
MI::UnorderedMetric
- Parameters:
size (int) – Number of records in input data.
MI (DatasetMetric) – Input Metric.
TA (Type Argument) – Atomic Type.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – 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
.make_split_dataframe in Rust documentation.
Supporting Elements:
Input Domain:
AllDomain<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 (Any) – 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
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_split_lines()[source]#
Make a Transformation that takes a string and splits it into a
Vec<String>
of its lines.make_split_lines in Rust documentation.
Supporting Elements:
Input Domain:
AllDomain<String>
Output Domain:
VectorDomain<AllDomain<String>>
Input Metric:
SymmetricDistance
Output Metric:
SymmetricDistance
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – 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>>
.make_split_records in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AllDomain<String>>
Output Domain:
VectorDomain<VectorDomain<AllDomain<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
UnknownTypeError – 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.
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 (Any) – name of the boolean column that indicates inclusion in the subset
keep_columns (Any) – 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
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_unclamp(bounds, TA=None)[source]#
Make a Transformation that unclamps numeric data in
Vec<T>
.Used to convert a
VectorDomain<BoundedDomain<T>>
to aVectorDomain<AllDomain<T>>
.make_unclamp in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<BoundedDomain<TA>>
Output Domain:
VectorDomain<AllDomain<TA>>
Input Metric:
SymmetricDistance
Output Metric:
SymmetricDistance
- Parameters:
bounds (Tuple[Any, Any]) – Tuple of lower and upper bounds.
TA (Type Argument) – Atomic Type
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.transformations.make_unordered(TA)[source]#
Make a Transformation that converts the ordered dataset metric
InsertDeleteDistance
to the respective ordered dataset metric SymmetricDistance with a no-op. The input metric cannot be bounded (HammingDistance) because the dataset size is unknown.make_unordered in Rust documentation.
Supporting Elements:
Input Domain:
VectorDomain<AllDomain<TA>>
Output Domain:
VectorDomain<AllDomain<TA>>
Input Metric:
InsertDeleteDistance
Output Metric:
SymmetricDistance
- Parameters:
TA (Type Argument) – Atomic Type.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeError – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library