Exercise

# Single layer neural networks

To become comfortable using neural networks it will be helpful to start with a simple *approximation* of a function.

You'll train a neural network to approximate a mapping between an input, `x`

, and an output, `y`

. They are related by the **square root** function, i.e. \(y = \sqrt{x}\).

The input vector `x`

is given to you. You'll first compute the square root of `x`

using Numpy's `sqrt()`

function, generating the output series `y`

. Then you'll create a simple neural network and train the network on the `x`

series.

After training, you'll then plot both the `y`

series and the output of the neural network, to see how closely the network approximates the square root function.

The `Sequential`

and `Dense`

objects from the Keras library are also available in your workspace.

Instructions

**100 XP**

- Create the output training values using Numpy's
`sqrt()`

function. - Create the neural network with one hidden layer of 16 neurons, one input value, and one output value.
- Compile and fit the neural network on the training values, for 100 epochs
- Plot the training values (in blue) against the neural network's predicted values.