When I do:
summing += yval * np.log(sigmoid(np.dot(w.transpose(), xi.transpose()))) + (1-yval)* np.log(1-sigmoid(np.dot(w.transpose(), xi.transpose())))
Try to add a very small value, e.g., 1e-7, to the input. For example, sklearn library has a parameter eps for the log_loss function.
eps
https://www.kaggle.com/c/jigsaw-toxic-comment-classification-challenge/discussion/48701