Updated the comments.

This commit is contained in:
Batuhan Berk Başoğlu 2025-09-22 14:58:30 -04:00
parent 21cc1b1ca0
commit c81789fbd3
Signed by: batuhan-basoglu
SSH key fingerprint: SHA256:kEsnuHX+qbwhxSAXPUQ4ox535wFHu/hIRaa53FzxRpo

View file

@ -87,8 +87,8 @@ class LogisticRegression:
y_batch = self.y[idx] y_batch = self.y[idx]
# it returns X and Y batch values from a randomly permuted indices from start to end # it returns X and Y batch values from a randomly permuted indices from start to end
z = x_batch.dot(self.w) z = x_batch.dot(self.w) # linear prediction
p = self.sigmoid(z) p = self.sigmoid(z) # probabilities of the model predictions
grad = x_batch.T.dot(p - y_batch) / y_batch.size # gradient calculation formula grad = x_batch.T.dot(p - y_batch) / y_batch.size # gradient calculation formula
self.w -= self.lr * grad # gradient multiplied by learning rate is removed from weight self.w -= self.lr * grad # gradient multiplied by learning rate is removed from weight