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_factorfor 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. 
- Raises:
- TypeError – if an argument’s type differs from the expected type 
- UnknownTypeException – if a type argument fails to parse 
 
- Return type:
- int 
 
- 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 - bimmediate children.- Required features: - contrib- make_b_ary_tree in Rust documentation. - Supporting Elements: - Input Domain: - VectorDomain<AtomDomain<TA>>
- Output Domain: - M
- Input Metric: - VectorDomain<AtomDomain<TA>>
- Output Metric: - M
 - Parameters:
- 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 
 
- Return type:
 
- 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_clampto bound data and- make_resizeto establish dataset size.- S (summation algorithm) - input type - Sequential<S::Item>- Vec<S::Item>- Pairwise<S::Item>- Vec<S::Item>- S::Itemis 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 - f32half-precision floats, set- Sto- Pairwise<f32>.- Required features: - contrib- make_bounded_float_checked_sum in Rust documentation. - Citations: - Supporting Elements: - Input Domain: - VectorDomain<AtomDomain<S::Item>>
- Output Domain: - SymmetricDistance
- Input Metric: - AtomDomain<S::Item>
- Output Metric: - AbsoluteDistance<S::Item>
 - 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(- Tis shorthand for- S::Item)
 
- 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 
 
- Return type:
 
- 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_sumreturns an error due to potential for overflow. You may need to use- make_ordered_randomto impose an ordering on the data. The utility loss from overestimating the- size_limitis small.- S (summation algorithm) - input type - Sequential<S::Item>- Vec<S::Item>- Pairwise<S::Item>- Vec<S::Item>- S::Itemis 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 - f32half-precision floats, set- Sto- Pairwise<f32>.- Required features: - contrib- make_bounded_float_ordered_sum in Rust documentation. - Citations: - Supporting Elements: - Input Domain: - VectorDomain<AtomDomain<S::Item>>
- Output Domain: - InsertDeleteDistance
- Input Metric: - AtomDomain<S::Item>
- Output Metric: - AbsoluteDistance<S::Item>
 - 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(- Tis shorthand for- S::Item)
 
- 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 
 
- Return type:
 
- 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: - SymmetricDistance
- Input Metric: - AtomDomain<T>
- 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 
 
- 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 
 
- Return type:
 
- 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_randomto 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: - InsertDeleteDistance
- Input Metric: - AtomDomain<T>
- 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 
 
- 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 
 
- Return type:
 
- 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: - SymmetricDistance
- Input Metric: - AtomDomain<T>
- 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 
 
- 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 
 
- Return type:
 
- opendp.transformations.make_cast(input_domain, input_metric, TOA)[source]#
- Make a Transformation that casts a vector of data from type - TIAto type- TOA. For each element, failure to parse results in- None, else- Some(out).- Can be chained with - make_impute_constantor- make_drop_nullto handle nullity.- Required features: - contrib- make_cast in Rust documentation. - Supporting Elements: - Input Domain: - VectorDomain<AtomDomain<TIA>>
- Output Domain: - M
- Input Metric: - VectorDomain<OptionDomain<AtomDomain<TOA>>>
- Output Metric: - M
 - Parameters:
- input_domain (Domain) – Domain of input data 
- input_metric (Metric) – Metric on input domain 
- TOA (Type Argument) – Atomic Output Type to cast into 
 
- 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 
 
- Return type:
 
- opendp.transformations.make_cast_default(input_domain, input_metric, TOA)[source]#
- Make a Transformation that casts a vector of data from type - TIAto type- TOA. 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: - M
- Input Metric: - VectorDomain<AtomDomain<TOA>>
- Output Metric: - M
 - Parameters:
- input_domain (Domain) – Domain of input data 
- input_metric (Metric) – Metric on input domain 
- TOA (Type Argument) – Atomic Output Type to cast into 
 
- 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 
 
- Return type:
 
- opendp.transformations.make_cast_inherent(input_domain, input_metric, TOA)[source]#
- Make a Transformation that casts a vector of data from type - TIAto a type that can represent nullity- TOA. If cast fails, fill with- TOA’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: - M
- Input Metric: - VectorDomain<AtomDomain<TOA>>
- Output Metric: - M
 - Parameters:
- input_domain (Domain) – Domain of input data 
- input_metric (Metric) – Metric on input domain 
- TOA (Type Argument) – Atomic Output Type to cast into 
 
- 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 
 
- Return type:
 
- 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 - f32or- f64
- 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 
 
- Return type:
 
- opendp.transformations.make_clamp(input_domain, input_metric, bounds)[source]#
- Make a Transformation that clamps numeric data in - Vec<TA>to- bounds.- If datum is less than lower, let datum be lower. If datum is greater than upper, let datum be upper. - Required features: - contrib- make_clamp in Rust documentation. - Supporting Elements: - Input Domain: - VectorDomain<AtomDomain<TA>>
- Output Domain: - M
- Input Metric: - VectorDomain<AtomDomain<TA>>
- Output Metric: - M
 - Proof Definition: - Parameters:
- 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 
 
- Return type:
 
- 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. 
 
- 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 
 
- Return type:
 
- 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: - SymmetricDistance
- Input Metric: - AtomDomain<TO>
- 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. 
 
- 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 
 
- Return type:
 
- opendp.transformations.make_count_by(input_domain, input_metric, 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: - SymmetricDistance
- Input Metric: - MapDomain<AtomDomain<TK>, AtomDomain<TV>>
- Output Metric: - L01InfDistance<AbsoluteDistance<TV>>
 - Parameters:
- input_domain (Domain) – Domain of input data 
- input_metric (Metric) – Metric on input domain 
- 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). 
- 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 
 
- Return type:
 
- 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: - SymmetricDistance
- Input Metric: - VectorDomain<AtomDomain<TOA>>
- Output Metric: - MO
 - Parameters:
- input_domain (Domain) – Domain of input data 
- input_metric (Metric) – Metric on input domain 
- 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 (Type Argument) – Output Metric. 
- TOA (Type Argument) – Atomic Output Type that is numeric. 
 
- Returns:
- The carrier type is Vec<TOA>, a vector of the counts (TOA). 
- 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 
 
- Return type:
 
- 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: - SymmetricDistance
- Input Metric: - AtomDomain<TO>
- Output Metric: - AbsoluteDistance<TO>
 - Parameters:
- input_domain (Domain) – Domain of input data 
- input_metric (Metric) – Metric on input domain 
- TO (Type Argument) – Output Type. Must be numeric. 
 
- 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 
 
- Return type:
 
- 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: - SymmetricDistance
- Input Metric: - DataFrameDomain<K>
- Output Metric: - SymmetricDistance
 - Parameters:
- col_names – Column names for each record entry. 
- K (Type Argument) – categorical/hashable data type of column names 
 
- 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 
 
- Return type:
 - 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 - TIAto type- TOA. 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: - M
- Input Metric: - DataFrameDomain<TK>
- Output Metric: - M
 - Parameters:
- input_domain (Domain) – Domain of input data 
- input_metric (Metric) – Metric on input domain 
- 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 
 
- 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 
 
- Return type:
 - 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: - M
- Input Metric: - DataFrameDomain<TK>
- Output Metric: - M
 - Parameters:
- input_domain (Domain) – Domain of input data 
- input_metric (Metric) – Metric on input domain 
- column_name – Column name to be transformed 
- value – Value to check for equality 
- TIA (Type Argument) – Atomic Input Type to cast from 
 
- 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 
 
- Return type:
 - 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: - M
- Input Metric: - VectorDomain<AtomDomain<DIA::Imputed>>
- Output Metric: - M
 - Parameters:
- 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 
 
- Return type:
 
- 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, returns- Some(index), else- None. Chain with- make_impute_constantor- make_drop_nullto handle nullity.- Required features: - contrib- make_find in Rust documentation. - Supporting Elements: - Input Domain: - VectorDomain<AtomDomain<TIA>>
- Output Domain: - M
- Input Metric: - VectorDomain<OptionDomain<AtomDomain<usize>>>
- Output Metric: - M
 - Parameters:
- 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 
 
- Return type:
 
- 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. - edgessplits the entire range of- TIAinto bins. The first bin at index zero ranges from negative infinity to the first edge, non-inclusive. The last bin at index- edges.len()ranges from the last bin, inclusive, to positive infinity.- To be valid, - edgesmust be unique and ordered.- edgesare left inclusive, right exclusive.- Required features: - contrib- make_find_bin in Rust documentation. - Supporting Elements: - Input Domain: - VectorDomain<AtomDomain<TIA>>
- Output Domain: - M
- Input Metric: - VectorDomain<AtomDomain<usize>>
- Output Metric: - M
 - Parameters:
- 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 
 
- Return type:
 
- 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_domainand- input_metricpairing must form a valid metric space. For instance, the symmetric distance metric and atom domain do not form a valid metric space, because the metric cannot be used to measure distances between any two elements of an atom domain. Whereas, the symmetric distance metric and vector domain, or absolute distance metric and atom domain on a scalar type, both form valid metric spaces.- Supporting Elements: - Input Domain: - D
- Output Domain: - M
- Input Metric: - D
- Output Metric: - M
 - Parameters:
- 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 
 
- Return type:
 
- 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 is- Option<Vec<TA>>. If chaining after a- make_cast_inherent, the input type is- Vec<TA>, where- TAmay take on float NaNs.- input_domain - Input Data Type - vector_domain(option_domain(atom_domain(TA)))- Vec<Option<TA>>- vector_domain(atom_domain(TA))- Vec<TA>- Required features: - contrib- make_impute_constant in Rust documentation. - Supporting Elements: - Input Domain: - VectorDomain<DIA>
- Output Domain: - M
- Input Metric: - VectorDomain<AtomDomain<DIA::Imputed>>
- Output Metric: - M
 - Parameters:
- 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 
 
- Return type:
 
- 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 within- bounds.- Required features: - contrib- make_impute_uniform_float in Rust documentation. - Supporting Elements: - Input Domain: - VectorDomain<AtomDomain<TA>>
- Output Domain: - M
- Input Metric: - VectorDomain<AtomDomain<TA>>
- Output Metric: - M
 - Parameters:
- 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 
 
- Return type:
 
- 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: - M
- Input Metric: - VectorDomain<AtomDomain<TOA>>
- 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>.
 
- 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 
 
- Return type:
 
- 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: - M
- Input Metric: - VectorDomain<AtomDomain<bool>>
- Output Metric: - M
 - Proof Definition: - Parameters:
- 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 
 
- Return type:
 
- opendp.transformations.make_is_null(input_domain, input_metric)[source]#
- Make a Transformation that checks if each element in a vector is null or nan. - Required features: - contrib- make_is_null in Rust documentation. - Supporting Elements: - Input Domain: - VectorDomain<DIA>
- Output Domain: - M
- Input Metric: - VectorDomain<AtomDomain<bool>>
- Output Metric: - M
 - Parameters:
- 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 
 
- Return type:
 
- opendp.transformations.make_lipschitz_float_mul(input_domain, input_metric, constant, bounds)[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: - AtomDomain<TA>
- Output Domain: - AbsoluteDistance<TA>
- Input Metric: - AtomDomain<TA>
- Output Metric: - AbsoluteDistance<TA>
 - Parameters:
- 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 
 
- Return type:
 
- 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_clampto bound data and- make_resizeto establish dataset size.- Required features: - contrib- make_mean in Rust documentation. - Supporting Elements: - Input Domain: - VectorDomain<AtomDomain<T>>
- Output Domain: - MI
- Input Metric: - AtomDomain<T>
- Output Metric: - AbsoluteDistance<T>
 - Parameters:
- 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 
 
- Return type:
 
- opendp.transformations.make_metric_bounded(input_domain, input_metric)[source]#
- Make a Transformation that converts the unbounded dataset metric - MIto 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: - MI
- Input Metric: - D
- Output Metric: - MI::BoundedMetric
 - Parameters:
- 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 
 
- Return type:
 
- opendp.transformations.make_metric_unbounded(input_domain, input_metric)[source]#
- Make a Transformation that converts the bounded dataset metric - MIto 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: - MI
- Input Metric: - D
- Output Metric: - MI::UnboundedMetric
 - Parameters:
- 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 
 
- Return type:
 
- opendp.transformations.make_ordered_random(input_domain, input_metric)[source]#
- Make a Transformation that converts the unordered dataset metric - SymmetricDistanceto the respective ordered dataset metric- InsertDeleteDistanceby 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: - MI
- Input Metric: - D
- Output Metric: - MI::OrderedMetric
 - Parameters:
- 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 
 
- Return type:
 
- 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: - MI
- Input Metric: - VectorDomain<AtomDomain<u64>>
- Output Metric: - LInfDistance<u64>
 - Proof Definition: - Parameters:
- 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 
 
- Return type:
 
- 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 - linearor- nearest
- TA (Type Argument) – Atomic Type of the bin edges and data. 
- F (Type Argument) – Float type of the alpha argument. One of - f32or- f64
 
- 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 
 
- Return type:
 
- opendp.transformations.make_resize(input_domain, input_metric, size, constant, MO='SymmetricDistance')[source]#
- Make a Transformation that either truncates or imputes records with - constantto match a provided- size.- Required features: - contrib- make_resize in Rust documentation. - Supporting Elements: - Input Domain: - VectorDomain<AtomDomain<TA>>
- Output Domain: - MI
- Input Metric: - VectorDomain<AtomDomain<TA>>
- Output Metric: - MO
 - 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 - InsertDeleteDistanceor- SymmetricDistance
 
- Returns:
- A vector of the same type TA, but with the provided size. 
- 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 
 
- Return type:
 
- opendp.transformations.make_select_column(key, TOA, K=None)[source]#
- Make a Transformation that retrieves the column - keyfrom a dataframe as- Vec<TOA>.- Required features: - contrib- make_select_column in Rust documentation. - Supporting Elements: - Input Domain: - DataFrameDomain<K>
- Output Domain: - SymmetricDistance
- Input Metric: - VectorDomain<AtomDomain<TOA>>
- Output Metric: - SymmetricDistance
 - 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 
 
- 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 
 
- Return type:
 - 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::Itemis 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 - f32half-precision floats, set- Sto- Pairwise<f32>.- Required features: - contrib- make_sized_bounded_float_checked_sum in Rust documentation. - Citations: - Supporting Elements: - Input Domain: - VectorDomain<AtomDomain<S::Item>>
- Output Domain: - SymmetricDistance
- Input Metric: - AtomDomain<S::Item>
- Output Metric: - AbsoluteDistance<S::Item>
 - 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(- Tis shorthand for- S::Item)
 
- 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 
 
- Return type:
 
- 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_sumreturns an error due to potential for overflow. This uses a restricted-sensitivity proof that takes advantage of known dataset size for better utility. You may need to use- make_ordered_randomto impose an ordering on the data.- S (summation algorithm) - input type - Sequential<S::Item>- Vec<S::Item>- Pairwise<S::Item>- Vec<S::Item>- S::Itemis 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 - f32half-precision floats, set- Sto- Pairwise<f32>.- Required features: - contrib- make_sized_bounded_float_ordered_sum in Rust documentation. - Citations: - Supporting Elements: - Input Domain: - VectorDomain<AtomDomain<S::Item>>
- Output Domain: - InsertDeleteDistance
- Input Metric: - AtomDomain<S::Item>
- Output Metric: - AbsoluteDistance<S::Item>
 - 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(- Tis shorthand for- S::Item)
 
- 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 
 
- Return type:
 
- 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: - SymmetricDistance
- Input Metric: - AtomDomain<T>
- 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 
 
- 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 
 
- Return type:
 
- 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: - SymmetricDistance
- Input Metric: - AtomDomain<T>
- 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 
 
- 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 
 
- Return type:
 
- 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_randomto impose an ordering on the data.- Required features: - contrib- make_sized_bounded_int_ordered_sum in Rust documentation. - Citations: - Supporting Elements: - Input Domain: - VectorDomain<AtomDomain<T>>
- Output Domain: - InsertDeleteDistance
- Input Metric: - AtomDomain<T>
- Output Metric: - AbsoluteDistance<T>
 - 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 
 
- 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 
 
- Return type:
 
- 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: - SymmetricDistance
- Input Metric: - AtomDomain<T>
- 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 
 
- 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 
 
- Return type:
 
- 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 by- col_names.- Required features: - contrib- make_split_dataframe in Rust documentation. - Supporting Elements: - Input Domain: - AtomDomain<String>
- Output Domain: - SymmetricDistance
- Input Metric: - DataFrameDomain<K>
- Output Metric: - SymmetricDistance
 - 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 
 
- 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 
 
- Return type:
 - 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: - SymmetricDistance
- Input Metric: - VectorDomain<AtomDomain<String>>
- Output Metric: - SymmetricDistance
 - 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 
 
- Return type:
 
- opendp.transformations.make_split_records(separator)[source]#
- Make a Transformation that splits each record in a - Vec<String>into a- Vec<Vec<String>>.- Required features: - contrib- make_split_records in Rust documentation. - Supporting Elements: - Input Domain: - VectorDomain<AtomDomain<String>>
- Output Domain: - SymmetricDistance
- Input Metric: - VectorDomain<VectorDomain<AtomDomain<String>>>
- Output Metric: - SymmetricDistance
 - Parameters:
- separator (str) – The token(s) that separate entries in each record. 
- 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 
 
- Return type:
 
- 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: - WildExprDomain
- Output Domain: - MI
- Input Metric: - ExprDomain
- Output Metric: - MO
 - Parameters:
- 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 
 
- Return type:
 
- 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: - MI
- Input Metric: - LazyFrameDomain
- Output Metric: - MO
 - Parameters:
- 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 
 
- Return type:
 
- 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: - SymmetricDistance
- Input Metric: - DataFrameDomain<TK>
- 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 
 
- 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 
 
- Return type:
 - 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_clampto 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: - MI
- Input Metric: - AtomDomain<T>
- Output Metric: - AbsoluteDistance<T>
 - Parameters:
- 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 
 
- Return type:
 
- 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_clampto bound data and- make_resizeto establish dataset size.- S (summation algorithm) - input type - Sequential<S::Item>- Vec<S::Item>- Pairwise<S::Item>- Vec<S::Item>- S::Itemis 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 - f32half-precision floats, set- Sto- Pairwise<f32>.- Required features: - contrib- make_sum_of_squared_deviations in Rust documentation. - Citations: - Supporting Elements: - Input Domain: - VectorDomain<AtomDomain<S::Item>>
- Output Domain: - SymmetricDistance
- Input Metric: - AtomDomain<S::Item>
- Output Metric: - AbsoluteDistance<S::Item>
 - Parameters:
- input_domain (Domain) – Domain of input data 
- input_metric (Metric) – Metric on input domain 
- S (Type Argument) – Summation algorithm to use on data type - T. One of- Sequential<T>or- Pairwise<T>.
 
- 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 
 
- Return type:
 
- opendp.transformations.make_unordered(input_domain, input_metric)[source]#
- Make a Transformation that converts the ordered dataset metric - MIto 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: - MI
- Input Metric: - D
- Output Metric: - MI::UnorderedMetric
 - Parameters:
- 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 
 
- Return type:
 
- 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), where- d_inhas the associated type for- input_metricand- d_outhas the associated type for- output_metric, if \(x, x'\) are- d_in-close under- input_metric,- stability_map(d_in)does not raise an exception, and- stability_map(d_in) <= d_out, then- function(x), function(x')are d_out-close under- output_metric.- In addition, for every element \(x\) in - input_domain,- function(x)is a member of- output_domainor raises a data-independent runtime exception.- In addition, - functionmust not have side-effects, and- stability_mapmust 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_domainto- output_domain.
- stability_map – A function mapping distances from - input_metricto- output_metric.
 
- 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 
 
- Return type:
 
- 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_clampto bound data and- make_resizeto establish dataset size.- Required features: - contrib- make_variance in Rust documentation. - Citations: - Supporting Elements: - Input Domain: - VectorDomain<AtomDomain<S::Item>>
- Output Domain: - SymmetricDistance
- Input Metric: - AtomDomain<S::Item>
- Output Metric: - AbsoluteDistance<S::Item>
 - Parameters:
- input_domain (Domain) – Domain of input data 
- input_metric (Metric) – Metric on 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 of- Sequential<T>or- Pairwise<T>.
 
- 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 
 
- Return type:
 
- opendp.transformations.then_b_ary_tree(leaf_count, branching_factor)[source]#
- partial constructor of make_b_ary_tree - See also - Delays application of - input_domainand- input_metricin- opendp.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_domainand- input_metricin- opendp.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_domainand- input_metricin- opendp.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_domainand- input_metricin- opendp.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_domainand- input_metricin- opendp.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_domainand- input_metricin- opendp.transformations.make_count()- Parameters:
- TO (Type Argument) – Output Type. Must be numeric. 
 
- opendp.transformations.then_count_by(TV='int')[source]#
- partial constructor of make_count_by - See also - Delays application of - input_domainand- input_metricin- opendp.transformations.make_count_by()- Parameters:
- 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_domainand- input_metricin- opendp.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 (Type Argument) – 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_domainand- input_metricin- opendp.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_domainand- input_metricin- opendp.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_domainand- input_metricin- opendp.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_domainand- input_metricin- opendp.transformations.make_drop_null()
- opendp.transformations.then_find(categories)[source]#
- partial constructor of make_find - See also - Delays application of - input_domainand- input_metricin- opendp.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_domainand- input_metricin- opendp.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_domainand- input_metricin- opendp.transformations.make_identity()
- opendp.transformations.then_impute_constant(constant)[source]#
- partial constructor of make_impute_constant - See also - Delays application of - input_domainand- input_metricin- opendp.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_domainand- input_metricin- opendp.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_domainand- input_metricin- opendp.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_domainand- input_metricin- opendp.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_domainand- input_metricin- opendp.transformations.make_is_null()
- opendp.transformations.then_lipschitz_float_mul(constant, bounds)[source]#
- partial constructor of make_lipschitz_float_mul - See also - Delays application of - input_domainand- input_metricin- opendp.transformations.make_lipschitz_float_mul()- Parameters:
- constant – The constant to multiply aggregates by. 
- bounds (tuple[Any, Any]) – Tuple of inclusive lower and upper bounds. 
 
 
- opendp.transformations.then_mean()[source]#
- partial constructor of make_mean - See also - Delays application of - input_domainand- input_metricin- opendp.transformations.make_mean()
- opendp.transformations.then_metric_bounded()[source]#
- partial constructor of make_metric_bounded - See also - Delays application of - input_domainand- input_metricin- opendp.transformations.make_metric_bounded()
- opendp.transformations.then_metric_unbounded()[source]#
- partial constructor of make_metric_unbounded - See also - Delays application of - input_domainand- input_metricin- opendp.transformations.make_metric_unbounded()
- opendp.transformations.then_ordered_random()[source]#
- partial constructor of make_ordered_random - See also - Delays application of - input_domainand- input_metricin- opendp.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_domainand- input_metricin- opendp.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_domainand- input_metricin- opendp.transformations.make_resize()- Parameters:
- size (int) – Number of records in output data. 
- constant – Value to impute with. 
- MO (Type Argument) – Output Metric. One of - InsertDeleteDistanceor- SymmetricDistance
 
 
- opendp.transformations.then_stable_expr(expr)[source]#
- partial constructor of make_stable_expr - See also - Delays application of - input_domainand- input_metricin- opendp.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_domainand- input_metricin- opendp.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_domainand- input_metricin- opendp.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_domainand- input_metricin- opendp.transformations.make_sum_of_squared_deviations()- Parameters:
- S (Type Argument) – Summation algorithm to use on data type - T. One of- Sequential<T>or- Pairwise<T>.
 
- opendp.transformations.then_unordered()[source]#
- partial constructor of make_unordered - See also - Delays application of - input_domainand- input_metricin- opendp.transformations.make_unordered()
- opendp.transformations.then_variance(ddof=1, S='Pairwise<T>')[source]#
- partial constructor of make_variance - See also - Delays application of - input_domainand- input_metricin- opendp.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 of- Sequential<T>or- Pairwise<T>.
 
 
