# weights values per iteration for ANN in Keras

I am trying to output weights values for the last layer of my ANN per iteration. But from the following code I wrote, I could only output it for the last iteration, which means the final result. So how can I add it to per iteration?

```
model=Sequential()
model.add(Dense(3,activation='sigmoid',input_dim=8))
model.add(Dense(3,activation='sigmoid'))
model.add(Dense(10,activation='softmax'))
sgd=SGD(lr=0.1)
model.compile(optimizer=sgd,loss='categorical_crossentropy',metrics=['accuracy'])
print("Training----------")
model.fit(features_train,class_train,validation_data=(features_test,class_test),nb_epoch=100,batch_size=1)
weights = np.array(model.layers[2].get_weights())
print(weights)
```

Niccolò Cacciotti
answered question

### 1 Answer

I would strongly reccomend you to read this:

https://machinelearningmastery.com/check-point-deep-learning-models-keras/

Niccolò Cacciotti
posted this

## Have an answer?

JD