Passing group id to custom loss function

21 views
Skip to first unread message

Harry Cutler

unread,
Jun 5, 2023, 2:50:38 AMJun 5
to Keras-users
Hi Keras users,

I was hoping that someone might be able to give me a hand.

I've been using keras to model a disease risk factor in 11 different populations and am trying to create a custom loss function that is aware of these population groups.

Currently training the model with mse as the loss function, but I would like to encourage the model to condense the variation in its predictions for specific groups. Specifically, the screenshot below shows model performance where each colour represents a different population group. As an example, the green group is much narrower than the blue and purple group, suggesting that the model has done a better job learning that group. I would like to create a loss function to explicitly encourage the model to condense variation on the x-axis, however, I'm having trouble passing group ids to the loss function back end.

Is anyone able to suggest a workaround? I'd be incredibly grateful for any help that you are kind enough to provide. Please let me know if you have any questions.

00006b.png


Kind regards,
Harry

Alberto Matuozzo

unread,
Jun 11, 2023, 12:42:51 PMJun 11
to Harry Cutler, Keras-users
Hi,

What about simply using group id as a feature in the model?

--
You received this message because you are subscribed to the Google Groups "Keras-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keras-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/keras-users/600de67b-139a-4f1e-a06c-0764c27022e1n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages