How to define weights on Keras neural network
I have a neural network model written in Keras with (8,5,5,5,32) neurons, as follows:
# Sequential
model = Sequential()
# Neural network
model.add(Dense(5, input_dim=len(X[0]), activation='sigmoid' ))
model.add(Dense(5, activation='sigmoid' ))
model.add(Dense(5, activation='sigmoid' ))
model.add(Dense(len(y[0]), activation='sigmoid' ))
# Compile model
# sgd = optimizers.SGD(lr=0.01, decay=0.0, momentum=0.0, nesterov=False)
model.compile(loss='mean_squared_error', optimizer='adam', metrics=['acc'])
# Fit model
history = model.fit(X, y, nb_epoch=200, validation_split=0.2, batch_size=30)
When I access the weights after training, I get:
model.get_weights()
which returns a long array of arrays corresponding to the weights in between neurons of each layer. What I don't understand is a smaller array represents (same number of weights as number of neurons per layer) in between larger arrays (same number of sub-arrays as number of neurons per layer).
Is this the biais that the neurons experience?
Here are the results of 'model.get_weights()':
[array([[ <PHONE_NUMBER>, <PHONE_NUMBER>, -<PHONE_NUMBER>, -0.<PHONE_NUMBER>, -<PHONE_NUMBER>],
[ 0.<PHONE_NUMBER> , -<PHONE_NUMBER>, <PHONE_NUMBER>, -<PHONE_NUMBER>, <PHONE_NUMBER>],
<PHONE_NUMBER>, -<PHONE_NUMBER>, -0.05099263, <PHONE_NUMBER> , -<PHONE_NUMBER>],
<PHONE_NUMBER>, <PHONE_NUMBER>, <PHONE_NUMBER>, -0.13255124, <PHONE_NUMBER>],
<PHONE_NUMBER>, <PHONE_NUMBER>, <PHONE_NUMBER>, -<PHONE_NUMBER>, -<PHONE_NUMBER>],
<PHONE_NUMBER>, <PHONE_NUMBER>, -<PHONE_NUMBER>, <PHONE_NUMBER>, -<PHONE_NUMBER>],
<PHONE_NUMBER>, -0.207461 , 0.00371859, -<PHONE_NUMBER>, 0.10946763],
<PHONE_NUMBER>, -<PHONE_NUMBER>, -<PHONE_NUMBER>, 0.<PHONE_NUMBER> , -<PHONE_NUMBER>]], dtype=float32),
array([-0.<PHONE_NUMBER>, 0.04991768, 0.11635038, -0.<PHONE_NUMBER>, 0.0325128 ], dtype=float32), # WHAT IS THIS ARRAY REPRESENTING?
array([[ 0.10943446, -<PHONE_NUMBER>, <PHONE_NUMBER>, <PHONE_NUMBER>, -0.<PHONE_NUMBER>],
[ 0.<PHONE_NUMBER>, 0.<PHONE_NUMBER>, -<PHONE_NUMBER>, -0.19608408, <PHONE_NUMBER>],
<PHONE_NUMBER>, 0.19124934, -<PHONE_NUMBER>, -<PHONE_NUMBER>, <PHONE_NUMBER>],
<PHONE_NUMBER>, 0.<PHONE_NUMBER>, <PHONE_NUMBER>, <PHONE_NUMBER> , -0.<PHONE_NUMBER>],
[-0.<PHONE_NUMBER> , <PHONE_NUMBER> , <PHONE_NUMBER>, <PHONE_NUMBER>, <PHONE_NUMBER>]], dtype=float32),
array([-0.30626452, 0.15301916, -0.17855364, 0.12410269, <PHONE_NUMBER> ], dtype=float32),
array([[-0. 856