Reputation: 1037
[tensorflow backend]
I've built a model multiple heads and it works well. By default the accuracy and loss for every head is calculated and printed separately.
Epoch 2/2
45000/45000 [==============================] - 35s - loss: 0.1403 - dense_14_loss: 0.0109 - dense_15_loss: 0.0208 - dense_16_loss: 0.0276 - dense_17_loss: 0.0372 - dense_18_loss: 0.0438 - dense_14_acc: 0.9965 - dense_15_acc: 0.9937 - dense_16_acc: 0.9914 - dense_17_acc: 0.9882 - dense_18_acc: 0.9860 - val_loss: 0.2223 - val_dense_14_loss: 0.0155 - val_dense_15_loss: 0.0353 - val_dense_16_loss: 0.0469 - val_dense_17_loss: 0.0526 - val_dense_18_loss: 0.0720 - val_dense_14_acc: 0.9944 - val_dense_15_acc: 0.9886 - val_dense_16_acc: 0.9862 - val_dense_17_acc: 0.9842 - val_dense_18_acc: 0.9802
Can I write a custom metric that combines the single metrics and for example calculates the average as a single metric? Would also be helpful for using callbacks.
Upvotes: 2
Views: 703
Reputation: 7148
I am not sure if you can write a metric for multiple heads, but one way to accomplish what you want would be to get the return values of your fit
method and add them together manually and print that result. If you want faster feedback you will have to use train_on_batch
instead of fit
and write your own output with this method.
Upvotes: 1