Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ab0eed8

Browse files
committedJun 13, 2024·
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 6deff0c commit ab0eed8

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed
 

‎neural_network/binary_crossentropy.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414

1515
def binary_cross_entropy(y_true: np.ndarray, y_pred: np.ndarray) -> float:
1616
"""
17-
Implements the Binary Cross Entropy function.
18-
Parameters:
19-
y_true: the array containing input of actual label output i.e 0 or 1
20-
y_pred: the array containing predicted output
21-
return:
22-
float: the output value of binary crossentropy
23-
24-
Mathematically, BCE = -(1/N)*Sum(y_i * log(p_i)+(1 - y_i) * log(1 - p_i))
25-
26-
Examples:
27-
>>> binary_cross_entropy(np.array([1, 0, 1]), np.array([0.9, 0.2, 0.8]))
28-
0.18388253942874858
17+
Implements the Binary Cross Entropy function.
18+
Parameters:
19+
y_true: the array containing input of actual label output i.e 0 or 1
20+
y_pred: the array containing predicted output
21+
return:
22+
float: the output value of binary crossentropy
23+
24+
Mathematically, BCE = -(1/N)*Sum(y_i * log(p_i)+(1 - y_i) * log(1 - p_i))
25+
26+
Examples:
27+
>>> binary_cross_entropy(np.array([1, 0, 1]), np.array([0.9, 0.2, 0.8]))
28+
0.18388253942874858
2929
3030
3131
"""

0 commit comments

Comments
 (0)
Please sign in to comment.