Implemented gradient for sigmoid function