verified procedure for calculating gradient descent?

I'm wondering if there is a good procedure people are using for gradient descent that is pretty well validated--something like a package for R or Python, or generic code many people adapt. After taking Andrew Ng's machine learning course in Coursera I was able to implement gradient descent in Octave, but I'm hoping to work with it in R or Python, with which I am more familiar. I'm also hoping for something more standardized than code I would write itself, to give it more credibility with my place of employment or other researchers.

Most of what I've found on this site is questions about writing code for gradient descent, like this post (https://stats.stackexchange.com/questions/115425/multiplicative-gradient-descent ) and this one (https://stats.stackexchange.com/questions/142257/procedure-for-gradient-descent). And I've found examples of code from other sites, like this http://spin.atomicobject.com/2014/06/24/gradient-descent-linear-regression/.

So I think there is no gradient descent package for R. But I was wondering if people had any thoughts for a good way to start implementing it in R or Python that doesn't rely on trust in the individual coder (e.g. me). Is there a blog post or tutorial with good generic code that can easily be used to standardize different gradient descent implementations?

• Are you sure what you want is a gradient descent implementation? GD is often taught for pedagogical reasons as a general-purpose optimization routine, but other general-purpose optimizers are preferred over GD for reasons of numerical stability, precision, and not requiring any manual tuning. Some examples of these routines are implemented in R via optim. On CV.SE, @MarkLStone has made a hobby of trying to persuade people not to use GD; refer to his answers for more information. stats.stackexchange.com/users/78964/mark-l-stone – Sycorax Aug 24 '15 at 14:50
• Since GD is indeed pedagogical, there's this course in which they implement it for python. I don't think it is polite if I just post their code, but you can access the course materials for free. GD is implemented in lesson 3/Problem set 3. – lrnzcig Aug 25 '15 at 10:11
• thanks. I will check out @MarkLStone posts and optim, and think about alternatives to GD. – PSR Aug 26 '15 at 17:21