Skip to content

Commit 008d408

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent cf0ce13 commit 008d408

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

machine_learning/loss_functions.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@ def smooth_l1_loss(y_true: np.ndarray, y_pred: np.ndarray, beta: float = 1.0) ->
628628
loss = np.where(diff < beta, 0.5 * diff**2 / beta, diff - 0.5 * beta)
629629
return np.mean(loss)
630630

631+
631632
def kullback_leibler_divergence(y_true: np.ndarray, y_pred: np.ndarray) -> float:
632633
"""
633634
Calculate the Kullback-Leibler divergence (KL divergence) loss between true labels
@@ -673,8 +674,6 @@ def kullback_leibler_divergence(y_true: np.ndarray, y_pred: np.ndarray) -> float
673674
return np.sum(kl_loss)
674675

675676

676-
677-
678677
if __name__ == "__main__":
679678
import doctest
680679

0 commit comments

Comments
 (0)