cleanup and smoothed_values added.

This commit is contained in:
Marcus Eagan (marcussorealheis) 2023-04-01 15:25:31 -07:00
parent 84b232bf7b
commit f32f65cecf
No known key found for this signature in database
GPG Key ID: DBC835F366A6E6EC
2 changed files with 4 additions and 4 deletions

View File

@ -160,5 +160,5 @@ class AUROCWithMWU(torchmetrics.Metric):
# Compute auroc with the weight set to 1/2 when positive & negative have identical scores. # Compute auroc with the weight set to 1/2 when positive & negative have identical scores.
auroc = auroc_le - (auroc_le - auroc_lt) / 2.0 auroc = auroc_le - (auroc_le - auroc_lt) / 2.0
return auroc return auroc

View File

@ -21,7 +21,8 @@ def _smooth(
label_smoothing: smoothing constant. label_smoothing: smoothing constant.
Returns: Smoothed values. Returns: Smoothed values.
""" """
return value * (1.0 - label_smoothing) + 0.5 * label_smoothing smoothed_values = value * (1.0 - label_smoothing) + 0.5 * label_smoothing
return smoothed_values
def _binary_cross_entropy_with_clipping( def _binary_cross_entropy_with_clipping(
@ -179,7 +180,6 @@ class RCE(torchmetrics.Metric):
pred_ce = self.binary_cross_entropy.compute() pred_ce = self.binary_cross_entropy.compute()
rce = (1.0 - (pred_ce / baseline_ce)) * 100 rce = (1.0 - (pred_ce / baseline_ce)) * 100
return rce return rce
def reset(self): def reset(self):