Skip to content

Commit 45fcc94

Browse files
committed
add cross entropy loss to BCR
1 parent a570b68 commit 45fcc94

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

autolab_core/learning_analysis.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,10 @@ def __init__(self, pred_probs, labels, threshold=0.5):
353353
self.threshold = threshold
354354
ClassificationResult.__init__(self, pred_probs, labels)
355355

356+
@property
357+
def cross_entropy_loss(self):
358+
return np.mean((-1 * self.labels * np.log(self.pred_probs)) + (-1 * (1 - self.labels) * np.log(1 - self.pred_probs)))
359+
356360
@property
357361
def num_categories(self):
358362
return 2

0 commit comments

Comments
 (0)