Skip to content

Commit 019cfef

Browse files
committed
refactor: simplying binary classification
1 parent c5d9883 commit 019cfef

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

neuralnetlib/models.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,7 @@ def backward_pass(self, error: np.ndarray, gan: bool = False, compute_only: bool
204204
error = self.predictions - self.y_true
205205
elif (type(layer.activation_function).__name__ == "Sigmoid" and
206206
isinstance(self.loss_function, BinaryCrossentropy)):
207-
error = (self.predictions - self.y_true) / (self.predictions *
208-
(1 - self.predictions) + 1e-15)
207+
error = self.predictions - self.y_true
209208
elif isinstance(self.loss_function, SparseCategoricalCrossentropy):
210209
y_true_one_hot = np.zeros_like(self.predictions)
211210
y_true_one_hot[np.arange(

0 commit comments

Comments
 (0)