Let's see how to build a deep neural network:
- Create a new Python file, and import the following packages (the full code is given in the deep_neural_network.py file that is provided to you):
import neurolab as nl import numpy as np import matplotlib.pyplot as plt
- Let's define parameters to generate some training data:
# Generate training data min_value = -12 max_value = 12 num_datapoints = 90
- This training data will consist of a function we define that will transform the values. We expect the neural network to learn this on its own, based on the input and output values that we provide:
x = np.linspace(min_value, max_value, num_datapoints) y = 2 * np.square(x) + 7 y /= np.linalg.norm(y)
- Reshape the arrays:
data = x.reshape(num_datapoints, ...