half-finished version, changing to batch gradient descent