I can't seem to find much documentation on how to interpret the output of get_weights() when running a neural network in Keras. From what I understand, the output is determined by the structure of the network. Therefore, I paste a simplified version of the structure of my network below:
model.add(Dense(5, input_dim=2, activation = linear, use_bias=True, kernel_initializer=Orthogonal))
model.add(Dense(1, use_bias=True))
model.compile(loss='mae', optimizer='adam')
The output of get_weights() after training is:
[array([[ 0.79376745, 0.79879117, 1.22406125, 1.07782006, 1.24107373],
[ 0.88034034, 0.88281095, 1.13124955, 0.98677355, 1.14481246]], dtype=float32),
array([-0.09109745, -0.09036621, 0.0977743 , -0.07977977, 0.10829113], dtype=float32),
array([[-0.72631335],
[-0.38004425],
[ 0.62861812],
[ 0.10909595],
[ 0.30652359]], dtype=float32),
array([ 0.09278722], dtype=float32)]
There are a total of four arrays. What does each represent? Thanks!
get_weights method Returns the current weights of the layer, as NumPy arrays. The weights of a layer represent the state of the layer.
You can always get by layer too:
for lay in model.layers:
print(lay.name)
print(lay.get_weights())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With