In class LogisticRegression, this line
self.param -= self.learning_rate * -(y - y_pred).dot(X)
indicates that the gradient is calculated as -(y-y_pred).dot(X).
Apparently, a factor of 1 / n_samples is missed here.
The interesting part is that I found there is an issue about the similar problem in Regression.py.
It seems that the issue has been fixed, but only for Regression.py, not LogisticRegression.py
In class LogisticRegression, this line
indicates that the gradient is calculated as -(y-y_pred).dot(X).
Apparently, a factor of
1 / n_samplesis missed here.The interesting part is that I found there is an issue about the similar problem in Regression.py.
It seems that the issue has been fixed, but only for Regression.py, not LogisticRegression.py