CountDPRows#
from tmlt.tune import CountDPRows
- class tmlt.tune.CountDPRows(*, name=None, description=None, baseline=None, output=None, grouping_columns=None)#
Bases:
SingleOutputMetric
Computes the number of rows in the DP output.
If grouped, will return a count for every group that appears in either the DP or baseline output.
Example
>>> dp_df = spark.createDataFrame( ... pd.DataFrame( ... { ... "A": ["a1", "a2", "a3"], ... "X": [50, 110, 100] ... } ... ) ... ) >>> dp_outputs = {"O": dp_df} >>> baseline_df = spark.createDataFrame( ... pd.DataFrame( ... { ... "A": ["a1", "a2", "a3", "b"], ... "X": [100, 100, 100, 50] ... } ... ) ... ) >>> baseline_outputs = {"default": {"O": baseline_df}}
>>> metric = CountDPRows() >>> metric(dp_outputs, baseline_outputs).value 3
- count_dp_rows(dp_output, baseline_output, result_column_name)#
Counts the number of DP rows.