Start to implement sgd