As such , traditional gradient descent ( or Stochastic gradient descent ) methods can be adapted , where of taking a step in the direction of the function 's gradient , a step is taken in the direction of a vector selected from the function 's sub-gradient .