Keras: How to use different metrics for multi-output tasks?

Created on 18 Mar 2017  路  2Comments  路  Source: keras-team/keras

Hello,
I want to train a multitask network with 2 outputs, the first one with CE metric, and the second one with Cosine Similarity. I tried the following codes:
model.compile(loss='categorical_crossentropy', 'cosine_proximity') , but it seems to me both tasks are optimized with both metrics, thus 4 losses are printed out(task1 ce, task1 cosine, task2 ce, task 2 cosine). I wonder how to let task 1 only be optimized by CE, and task 2 only be optimized by Cosine (task1 ce, task2 cosine)?

stale

Most helpful comment

Taken from def compile of keras/engine/training.py

To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as metrics={'output_a': 'accuracy'}.

All 2 comments

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 30 days if no further activity occurs, but feel free to re-open a closed issue if needed.

Taken from def compile of keras/engine/training.py

To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as metrics={'output_a': 'accuracy'}.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

harishkrishnav picture harishkrishnav  路  3Comments

snakeztc picture snakeztc  路  3Comments

amityaffliction picture amityaffliction  路  3Comments

vinayakumarr picture vinayakumarr  路  3Comments

rantsandruse picture rantsandruse  路  3Comments