Python Stochastic Gradient Descent Algorithm Math