Below I’ve translated the original python code used in the post to R.
The original post has an excellent explanation of what each line does.
I’ve tried to stay as close quto the original code as possible,
all lines and comments correspond directly to the original code.
The code for the Neural Network in 11 lines of R is:
The output of this is:
After showing the 11 lines, Andrew builds a more simplistic version of this model in order to explain the workings,
the R version of this code is:
Finally a more legible version of the 11 lines model is developed, the R equivalent of this model is:
Andrew concludes his article with a number of helpful links, as well as the suggestion:
Try to rebuild this network from memory. I know that might sound a bit crazy, but it seriously helps. If you want to be able to create arbitrary architectures based on new academic papers or read and understand sample code for these different architectures, I think that it’s a killer exercise. I think it’s useful even if you’re using frameworks like Torch, Caffe, or Theano. I worked with neural networks for a couple years before performing this exercise, and it was the best investment of time I’ve made in the field (and it didn’t take long).
For R users it should hopefully be easier to do this using the code above.