The learNN package makes it easy to become familiar with the way neural networks work by demonstrating the key concepts using straightforward code examples. The package is based on previous post on this blog.

Andrew Trask wrote an amazing post at I am Trask called:

A Neural Network in 11 lines of Python

In the post Hand Coding a Neural Network I’ve translated the Python code into R.

In a follow up post called:

A Neural Network in 13 lines of Python

Andrew shows how to improve the network with optimisation through gradient descent.


The package can now be installed from CRAN using:

install.packages('learNN') # case sensitive!


After installation, the package can be loaded using:


For information on using the package, please refer to the help files.

help(package = 'learNN')

For examples of usage, see the function-specific help pages.

help('learn_bp') # learn Back Propagation
help('learn_gd') # learn Gradient Descent
help('learn_do') # learn DropOut

Additional Information

An overview of the changes is available in the NEWS file.

## Changes in version 0.2.0:
##     o   add WIOD data


A development version can be installed at your own peril, using:

if (!require('devtools')) install.packages('devtools')

Development takes place on the GitHub page, bugs can be filed on the Issues page.