Neural networks #
A neural network assembles neurons to represent a more complex function. The construction itself relies on a number of design parameters:
- the number of input and output neurons,
- the number of hidden neurons and how they are connected,
- weights, biases, and activation functions for each.
Together, the first two are often called the architecture of the neural network. We will try to get a sense of the type of functions that can be encoded by a neural network. We will focus on single-input single-output networks, that is, neural networks \(\mathcal{N} : \mathbb{R} \rightarrow \mathbb{R}.\)
Single hidden layer #
The following is an example of a one-input one-output neural network with a single hidden layer consisting of two neurons:
The graph of its output function is as follows:
Consider the function: \(\mathcal{f}(x) = \text{ReLU}(x-1)+ \text{ReLU}(-x-1) + 2.\) Its output function has the following graph:
Design a neural network that represents this function. Use the Mathematica notebook to graph and check your work. Your answer should be a neural network diagram specifying all weights, biases, and activation functions.
Two hidden layers #
The following is an example of a one-input one-output neural network with two hidden layers, each consisting of two neurons:
The output function of this neural network then looks like:
In general, the number of hidden layers and the number of neurons in each layer influence the complexity of the output function. It is an established theorem that any continuous function can be approximated by a neural network, albeit many neurons may be required to do so.