converters#
Wrappers for changing a transformation’s output metric.
Classes#
No-op transformation for switching from IfGroupedBy to its inner metric. |
|
No-op transformation for switching metrics. |
- class UnwrapIfGroupedBy(domain, input_metric)#
Bases:
tmlt.core.transformations.base.Transformation
No-op transformation for switching from IfGroupedBy to its inner metric.
- Parameters
domain (tmlt.core.domains.spark_domains.SparkDataFrameDomain) –
input_metric (tmlt.core.metrics.IfGroupedBy) –
- __init__(domain, input_metric)#
Constructor.
- Parameters
domain (
SparkDataFrameDomain
SparkDataFrameDomain
) – Domain of input DataFrames.input_metric (
IfGroupedBy
IfGroupedBy
) – IfGroupedBy metric on input DataFrames.
- stability_function(d_in)#
Returns the smallest d_out satisfied by the transformation.
If the inner metric of the
IfGroupedBy
input metric is aSumOf
, returns d_in.If the inner metric is
RootSumOfSquared
, returns d_in**2.- Parameters
d_in (tmlt.core.utils.exact_number.ExactNumberInput) – Distance between inputs under input_metric.
- Return type
- __call__(sdf)#
Returns DataFrame unchanged.
- Parameters
sdf (pyspark.sql.DataFrame) –
- Return type
- property input_domain#
Return input domain for the measurement.
- Return type
- property input_metric#
Distance metric on input domain.
- Return type
- property output_domain#
Return input domain for the measurement.
- Return type
- property output_metric#
Distance metric on input domain.
- Return type
- stability_relation(d_in, d_out)#
Returns True only if close inputs produce close outputs.
See the privacy and stability tutorial (add link?) for more information.
- Parameters
d_in (Any) – Distance between inputs under input_metric.
d_out (Any) – Distance between outputs under output_metric.
- Return type
- __or__(other: Transformation) Transformation #
- __or__(other: tmlt.core.measurements.base.Measurement) tmlt.core.measurements.base.Measurement
Return this transformation chained with another component.
- class HammingDistanceToSymmetricDifference(domain)#
Bases:
tmlt.core.transformations.base.Transformation
No-op transformation for switching metrics.
- Parameters
domain (tmlt.core.domains.spark_domains.SparkDataFrameDomain) –
- __init__(domain)#
Constructor.
- Parameters
domain (tmlt.core.domains.spark_domains.SparkDataFrameDomain) –
- stability_function(d_in)#
Returns the smallest d_out satisfied by the transformation.
Returns 2 * d_in
- Parameters
d_in (tmlt.core.utils.exact_number.ExactNumberInput) – Distance between inputs under input_metric.
- Return type
- __call__(data)#
Returns unchanged input.
- Parameters
data (Any) –
- property input_domain#
Return input domain for the measurement.
- Return type
- property input_metric#
Distance metric on input domain.
- Return type
- property output_domain#
Return input domain for the measurement.
- Return type
- property output_metric#
Distance metric on input domain.
- Return type
- stability_relation(d_in, d_out)#
Returns True only if close inputs produce close outputs.
See the privacy and stability tutorial (add link?) for more information.
- Parameters
d_in (Any) – Distance between inputs under input_metric.
d_out (Any) – Distance between outputs under output_metric.
- Return type
- __or__(other: Transformation) Transformation #
- __or__(other: tmlt.core.measurements.base.Measurement) tmlt.core.measurements.base.Measurement
Return this transformation chained with another component.