[英]weights values per iteration for ANN in Keras
I am trying to output weights values for the last layer of my ANN per iteration. 我正在尝试为每次迭代输出ANN的最后一层的权重值。 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)
I would strongly reccomend you to read this: 我强烈建议您阅读以下内容:
https://machinelearningmastery.com/check-point-deep-learning-models-keras/ https://machinelearningmastery.com/check-point-deep-learning-models-keras/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.