import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
def relu(x):
return np.max(0, x)
= np.array([[0, 0],
X 0, 1],
[1, 0],
[1, 1]])
[= np.array([0, 1, 1, 0]) y
0], X[:, 1],c=y) plt.scatter(X[:,
X.shape
(4, 2)
X
array([[0, 0],
[0, 1],
[1, 0],
[1, 1]])
= [2, 1] layers
= [np.zeros(n) for n in layers] B
= [None]*len(layers) W
0] = np.zeros((X.shape[1], layers[0])) W[
W
[array([[0., 0.],
[0., 0.]]), None]
for i in range(1, len(layers)):
= np.zeros((layers[i-1], layers[i])) W[i]
1] W[
array([[0.],
[0.]])
0].shape X.shape, W[
((4, 2), (2, 2))
X.shape
(4, 2)