im working on a neural network using Keras. Its an mlp(multi-layer perceptron). With 8 Neurons in the output layer. Is there a way I can access weights and biases of individual neurons of the output layer for every iteration?
The callback function can be used with
model.layers[-1].get_weights() to get weights per iteration.
weights= getweights = LambdaCallback(on_epoch_end=lambda batch, logs: weights.append(model.layers[-1].get_weights())) model.fit(x, y, batch_size=5,epochs=10, callbacks=[getweights]) print(weights)
In the given code weights is a list which contains weight values for the first Neuron/class of output Layer.