mirror of
https://github.com/twitter/the-algorithm-ml.git
synced 2024-12-23 14:51:49 +01:00
cleanup and smoothed_values added.
This commit is contained in:
parent
84b232bf7b
commit
f32f65cecf
@ -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
|
||||||
|
|
@ -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):
|
||||||
|
Loading…
Reference in New Issue
Block a user