In this doc, the multi output modeling is demonstrated as follows
# Stick a logistic regression for priority prediction on top of the features
priority_pred = layers.Dense(1, name="priority")(x)
# Stick a department classifier on top of the features
department_pred = layers.Dense(num_departments, name="department")(x)
# Instantiate an end-to-end model predicting both priority and department
model = keras.Model(
inputs=[title_input, body_input, tags_input],
outputs={"priority": priority_pred, "department": department_pred},
)
model.compile(
optimizer=keras.optimizers.RMSprop(1e-3),
loss={
"priority": keras.losses.BinaryCrossentropy(from_logits=True),
"department": keras.losses.CategoricalCrossentropy(from_logits=True),
},
loss_weights={"priority": 1.0, "department": 0.2},
)
model.fit
And the log messages are below. The loss
here is the total loss of the multi objective. But how to get individual objective for priority
and department
target? In keras 2, it gives all of them but not in keras 3.
Epoch 1/2
40/40 ━ 1s 12ms/step - loss: 1.2673
Epoch 2/2
40/40 ━ 0s 12ms/step - loss: 1.2440
Comment From: haifeng-jin
@innat Thanks for the issue! We would like to keep the logs clearer with a single output loss. It may also significantly add to the code complexity if we want to support this feature.
The user would need to add anything that they want to display separately to the metrics.
Comment From: google-ml-butler[bot]