3.3 Display the weights and biases of our model

In [18]:
# Input layer
weights0 = model.layers[0].get_weights()[0]
biases0 = model.layers[0].get_weights()[1]
print("Input layer weights",weights0.shape,":\n",weights0)
print("Input layer biases",biases0.shape,":\n",biases0)

# Output layer
weights1 = model.layers[1].get_weights()[0]
biases1 = model.layers[1].get_weights()[1]
print("\nOutput layer weights",weights1.shape,":\n",weights1)
print("Output layer biases",biases1.shape,":\n",biases1)
Input layer weights (2, 6) :
 [[-3.102217   -0.1727219   0.11697399  0.17580256 -2.04008     6.257991  ]
 [ 4.31225    -0.09573738  0.12220544 -0.09735721 -4.6750393   0.647255  ]]
Input layer biases (6,) :
 [-1.3760477  -0.22724889 -0.2330104  -0.27733225 -1.3143138  -1.5340173 ]

Output layer weights (6, 1) :
 [[-7.6477985 ]
 [ 0.15275961]
 [ 0.15407228]
 [ 0.26905262]
 [-7.420966  ]
 [-6.0084805 ]]
Output layer biases (1,) :
 [10.264609]