in src/smclarify/bias/metrics/pretraining.py [0:0]
def TVD(label: pd.Series, sensitive_facet_index: pd.Series) -> float:
r"""
Total Variation Distance (TVD)
.. math::
TVD = 0.5 * L1(Pa, Pd) \geq 0
:param label: column of labels
:param sensitive_facet_index: boolean column indicating sensitive group
:return: total variation distance metric
"""
Lp_res = LP_norm(label, sensitive_facet_index, 1)
tvd = 0.5 * Lp_res
return tvd