March 2020
Beginner to intermediate
342 pages
8h 38m
English
Let’s switch from the perceptron to the neural network. What does its decision boundary look like?
If you bother to try the neural network on the linearly separable dataset, you’ll find that it gets the same perfect accuracy as the perceptron, and a similarly straight decision boundary. On the second dataset, however, things get interesting.
Here’s the code that trains the neural network on the non-linearly separable dataset:
| | import numpy as np |
| | import neural_network as nn |
| | x1, x2, y = np.loadtxt('non_linearly_separable.txt', skiprows=1, unpack=True) |
| | X_train = X_test = np.column_stack((x1, x2)) |
| | Y_train_unencoded = Y_test = y.astype(int).reshape(-1, 1) |
| |
Read now
Unlock full access