Writing a neural network with Base R

For this example, we will use Base R to create a very simple neural network from scratch to better understand exactly what is happening at each step. In order to complete this task we will do the following:

  • Define the activation function for the neurons in our model
  • Create a function that shows the line after every iteration of learning the weights
  • Make some test data and plot these data values
  • Update weights using the results of the previous attempt

We will use the following steps to do so:

  1. First, we code the Heaviside (binary) step activation function to start. We will recall that this function evaluates the input and if this value is greater than zero, then the output value of the function is 1

Get Hands-On Deep Learning with R now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.