fixed bug in train, added gradient descent, still need testing